Unionfs: don't check parent dentries
authorErez Zadok <ezk@cs.sunysb.edu>
Fri, 28 Dec 2007 15:53:44 +0000 (10:53 -0500)
committerErez Zadok <ezk@cs.sunysb.edu>
Fri, 12 Aug 2011 02:37:23 +0000 (22:37 -0400)
Parent dentries may not be locked and may change, so don't check them.  But
do check parent inodes if they are passed to the method.  Also, ensure the
checks are done only if no error occurred.

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

index b8357a726ecacc455cc86188e5e52e7ae19a4736..2c32ada1612e69891ffb6838a02ca1d61b54b26a 100644 (file)
@@ -588,7 +588,6 @@ out_nofree:
                unionfs_copy_attr_times(dentry->d_parent->d_inode);
                unionfs_copy_attr_times(inode);
                unionfs_check_file(file);
-               unionfs_check_dentry(dentry->d_parent);
                unionfs_check_inode(inode);
        }
        unionfs_read_unlock(inode->i_sb);
index b63204285e9b6c4978fc3c5ab8ec4da7849c6ccb..0c424f62c2ad67591ff788b2a85eefc9c2780539 100644 (file)
@@ -66,7 +66,6 @@ out:
                /* copyup could cause parent dir times to change */
                unionfs_copy_attr_times(file->f_path.dentry->d_parent->d_inode);
                unionfs_check_file(file);
-               unionfs_check_dentry(file->f_path.dentry->d_parent);
        }
        unionfs_read_unlock(file->f_path.dentry->d_sb);
        return err;
index 740d36466dad84626220c594c03fa73020b814a9..6095c4f459e6d0a495bbfa1cd425193300c196f8 100644 (file)
@@ -157,7 +157,6 @@ out:
 
        unionfs_check_inode(parent);
        if (!err) {
-               unionfs_check_dentry(dentry->d_parent);
                unionfs_check_dentry(dentry);
                unionfs_check_nd(nd);
        }
@@ -207,14 +206,16 @@ static struct dentry *unionfs_lookup(struct inode *parent,
        }
 
        unionfs_check_inode(parent);
-       unionfs_check_dentry(dentry);
-       unionfs_check_dentry(dentry->d_parent);
-       unionfs_check_nd(nd);
-       if (!IS_ERR(ret))
+       if (!IS_ERR(ret)) {
+               unionfs_check_dentry(dentry);
+               unionfs_check_nd(nd);
                unionfs_unlock_dentry(dentry);
+       }
 
-       if (dentry != dentry->d_parent)
+       if (dentry != dentry->d_parent) {
+               unionfs_check_dentry(dentry->d_parent);
                unionfs_unlock_dentry(dentry->d_parent);
+       }
        unionfs_read_unlock(dentry->d_sb);
 
        return ret;
@@ -520,8 +521,7 @@ out:
 
        unionfs_check_inode(parent);
        if (!err)
-               unionfs_check_dentry(dentry->d_parent);
-       unionfs_check_dentry(dentry);
+               unionfs_check_dentry(dentry);
        unionfs_unlock_dentry(dentry);
        unionfs_read_unlock(dentry->d_sb);
        return err;
@@ -815,8 +815,7 @@ out:
 
        unionfs_check_inode(parent);
        if (!err)
-               unionfs_check_dentry(dentry->d_parent);
-       unionfs_check_dentry(dentry);
+               unionfs_check_dentry(dentry);
        unionfs_unlock_dentry(dentry);
        unionfs_read_unlock(dentry->d_sb);
        return err;
@@ -1110,8 +1109,8 @@ static int unionfs_setattr(struct dentry *dentry, struct iattr *ia)
        /* if setattr succeeded, then parent dir may have changed */
        unionfs_copy_attr_times(dentry->d_parent->d_inode);
 out:
-       unionfs_check_dentry(dentry);
-       unionfs_check_dentry(dentry->d_parent);
+       if (!err)
+               unionfs_check_dentry(dentry);
        unionfs_unlock_dentry(dentry);
        unionfs_read_unlock(dentry->d_sb);