Unionfs: copy lower times in fsync/fasync only when needed
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/file.c

index 9085d0e3f486ebd2a7f06f99ecb75e161221db8f..a534068fd66658e80a7562adb9e441064799313e 100644 (file)
@@ -196,13 +196,13 @@ int unionfs_fsync(struct file *file, struct dentry *dentry, int datasync)
                err = lower_inode->i_fop->fsync(lower_file,
                                                lower_dentry,
                                                datasync);
+               if (!err && bindex == bstart)
+                       fsstack_copy_attr_times(inode, lower_inode);
                mutex_unlock(&lower_inode->i_mutex);
                if (err)
                        goto out;
        }
 
-       unionfs_copy_attr_times(inode);
-
 out:
        if (!err)
                unionfs_check_file(file);
@@ -244,13 +244,13 @@ int unionfs_fasync(int fd, struct file *file, int flag)
                lower_file = unionfs_lower_file_idx(file, bindex);
                mutex_lock(&lower_inode->i_mutex);
                err = lower_inode->i_fop->fasync(fd, lower_file, flag);
+               if (!err && bindex == bstart)
+                       fsstack_copy_attr_times(inode, lower_inode);
                mutex_unlock(&lower_inode->i_mutex);
                if (err)
                        goto out;
        }
 
-       unionfs_copy_attr_times(inode);
-
 out:
        if (!err)
                unionfs_check_file(file);