Unionfs: lock inode around calls to notify_change()
authorErez Zadok <ezk@cs.sunysb.edu>
Tue, 15 Apr 2008 17:25:21 +0000 (13:25 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Sat, 19 Jul 2008 03:22:59 +0000 (23:22 -0400)
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/copyup.c
fs/unionfs/inode.c

index f71bddf40aed93ad969f0f02bf72e1c90f9b7c79..6d1e461186fc969c046a837753b3753e541657e6 100644 (file)
@@ -135,6 +135,7 @@ static int copyup_permissions(struct super_block *sb,
        newattrs.ia_valid = ATTR_CTIME | ATTR_ATIME | ATTR_MTIME |
                ATTR_ATIME_SET | ATTR_MTIME_SET | ATTR_FORCE |
                ATTR_GID | ATTR_UID;
+       mutex_lock(&new_lower_dentry->d_inode->i_mutex);
        err = notify_change(new_lower_dentry, &newattrs);
        if (err)
                goto out;
@@ -152,6 +153,7 @@ static int copyup_permissions(struct super_block *sb,
        }
 
 out:
+       mutex_unlock(&new_lower_dentry->d_inode->i_mutex);
        return err;
 }
 
index ff0ec9057335902a8cce2d0d540e6ffcb23dabc0..f6011290ee563a84992182370fe192f5d6f94a39 100644 (file)
@@ -1040,7 +1040,9 @@ static int unionfs_setattr(struct dentry *dentry, struct iattr *ia)
        }
 
        /* notify the (possibly copied-up) lower inode */
+       mutex_lock(&lower_dentry->d_inode->i_mutex);
        err = notify_change(lower_dentry, ia);
+       mutex_unlock(&lower_dentry->d_inode->i_mutex);
        if (err)
                goto out;