Unionfs: bugfix: don't call branchget() until dentry_open succeeded
authorErez_Zadok <ezk@cs.sunysb.edu>
Tue, 17 Jul 2007 03:56:26 +0000 (23:56 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Sun, 24 Nov 2013 18:29:53 +0000 (13:29 -0500)
If dentry_open fails, we incorrectly have incremented our branch counts
which would prevent unionfs from being unmounted (EBUSY).

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/commonfops.c

index 46e5008fbbcb28c4dc7855d80dccf073e7e200da..42678a6ec1fe400e0b2b46ae5773e6c300aa8328 100644 (file)
@@ -216,7 +216,6 @@ static int open_highest_file(struct file *file, int willwrite)
 
        dget(lower_dentry);
        unionfs_mntget(dentry, bstart);
-       branchget(sb, bstart);
        lower_file = dentry_open(lower_dentry,
                                 unionfs_lower_mnt_idx(dentry, bstart),
                                 file->f_flags);
@@ -224,6 +223,7 @@ static int open_highest_file(struct file *file, int willwrite)
                err = PTR_ERR(lower_file);
                goto out;
        }
+       branchget(sb, bstart);
        unionfs_set_lower_file(file, lower_file);
        /* Fix up the position. */
        lower_file->f_pos = file->f_pos;