Merge git://git.kernel.org/pub/scm/linux/kernel/git/aia21/ntfs
[cascardo/linux.git] / fs / gfs2 / dir.c
index 1a349f9..5d4261f 100644 (file)
@@ -2100,8 +2100,13 @@ int gfs2_diradd_alloc_required(struct inode *inode, const struct qstr *name,
        }
        if (IS_ERR(dent))
                return PTR_ERR(dent);
-       da->bh = bh;
-       da->dent = dent;
+
+       if (da->save_loc) {
+               da->bh = bh;
+               da->dent = dent;
+       } else {
+               brelse(bh);
+       }
        return 0;
 }