From afd62e9f09f56ab11838bb8a05e330ac8785a5bc Mon Sep 17 00:00:00 2001 From: Erez Zadok Date: Tue, 6 Sep 2011 00:57:42 -0400 Subject: [PATCH] Unionfs: ->fsync updates for new prototype Also use lockdep_off/on in unionfs_fsync. Signed-off-by: Erez Zadok --- fs/unionfs/copyup.c | 3 +++ fs/unionfs/file.c | 12 ++++++++---- fs/unionfs/union.h | 3 ++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/fs/unionfs/copyup.c b/fs/unionfs/copyup.c index 37c2654f615..078ca274088 100644 --- a/fs/unionfs/copyup.c +++ b/fs/unionfs/copyup.c @@ -325,8 +325,11 @@ static int __copyup_reg_data(struct dentry *dentry, kfree(buf); +#if 0 + /* XXX: code no longer needed? */ if (!err) err = output_file->f_op->fsync(output_file, 0); +#endif if (err) goto out_close_out; diff --git a/fs/unionfs/file.c b/fs/unionfs/file.c index 416c52f4c48..f583c8fc5a2 100644 --- a/fs/unionfs/file.c +++ b/fs/unionfs/file.c @@ -188,7 +188,7 @@ out: return err; } -int unionfs_fsync(struct file *file, int datasync) +int unionfs_fsync(struct file *file, loff_t start, loff_t end, int datasync) { int bindex, bstart, bend; struct file *lower_file; @@ -198,6 +198,7 @@ int unionfs_fsync(struct file *file, int datasync) struct inode *lower_inode, *inode; int err = -EINVAL; + lockdep_off(); unionfs_read_lock(dentry->d_sb, UNIONFS_SMUTEX_PARENT); parent = unionfs_lock_parent(dentry, UNIONFS_DMUTEX_PARENT); unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD); @@ -207,6 +208,10 @@ int unionfs_fsync(struct file *file, int datasync) goto out; unionfs_check_file(file); + err = generic_file_fsync(file, start, end, datasync); + if (err) + goto out; + bstart = fbstart(file); bend = fbend(file); if (bstart < 0 || bend < 0) @@ -224,11 +229,9 @@ int unionfs_fsync(struct file *file, int datasync) continue; lower_file = unionfs_lower_file_idx(file, bindex); lower_dentry = unionfs_lower_dentry_idx(dentry, bindex); - mutex_lock(&lower_inode->i_mutex); - err = lower_inode->i_fop->fsync(lower_file, datasync); + err = vfs_fsync_range(lower_file, start, end, datasync); if (!err && bindex == bstart) fsstack_copy_attr_times(inode, lower_inode); - mutex_unlock(&lower_inode->i_mutex); if (err) goto out; } @@ -239,6 +242,7 @@ out: unionfs_unlock_dentry(dentry); unionfs_unlock_parent(dentry, parent); unionfs_read_unlock(dentry->d_sb); + lockdep_on(); return err; } diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h index 1821705bbc9..07f6c2fdbd6 100644 --- a/fs/unionfs/union.h +++ b/fs/unionfs/union.h @@ -416,7 +416,8 @@ extern int unionfs_file_release(struct inode *inode, struct file *file); extern int unionfs_flush(struct file *file, fl_owner_t id); extern long unionfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg); -extern int unionfs_fsync(struct file *file, int datasync); +extern int unionfs_fsync(struct file *file, loff_t start, loff_t end, + int datasync); extern int unionfs_fasync(int fd, struct file *file, int flag); /* Inode operations */ -- 2.34.1