Unionfs: lock inode around calls to notify_change()
authorErez Zadok <ezk@cs.sunysb.edu>
Tue, 15 Apr 2008 23:08:44 +0000 (19:08 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Tue, 15 Apr 2008 23:08:44 +0000 (19:08 -0400)
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/copyup.c
fs/unionfs/inode.c

index a2ec45964347f011f02baa307db1197337cc6c7f..02e909cc88bed48af978c9dc8dcd3379fdccb2ed 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 c490303a6d3f9c18ad83ed4a4ec044d2f33096b7..04429a1281ce8f69142a095a0439f27ce5ee85e0 100644 (file)
@@ -1022,7 +1022,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;