[PATCH vfs-next 2/2] ovl: Adapt ovl_dir_fsync() to updated API in ->fsync()

From: Sedat Dilek
Date: Fri Jul 22 2011 - 11:56:19 EST

Based on a proposal patch from Miklos Szeredi <miklos@xxxxxxxxxx>.

Adapt ovl_dir_fsync() to recent changes in vfs-2.6.git#for-next.

Documentation/filesystems/porting says:

If you have your own ->fsync() you must make sure to call
filemap_write_and_wait_range() so that all dirty pages are synced out properly.
You must also keep in mind that ->fsync() is not called with i_mutex held
anymore, so if you require i_mutex locking you must make sure to take it and
release it yourself.

For more details see:

commit cbc4facd43b3502f644d7f01a9a48f8bec5f3e57
"fs: push i_mutex and filemap_write_and_wait down into ->fsync() handlers"

Signed-off-by: Sedat Dilek <sedat.dilek@xxxxxxxxx>
fs/overlayfs/readdir.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c
index 48e35a8..6fcda39 100644
--- a/fs/overlayfs/readdir.c
+++ b/fs/overlayfs/readdir.c
@@ -386,7 +386,8 @@ out_unlock:
return res;

-static int ovl_dir_fsync(struct file *file, int datasync)
+static int ovl_dir_fsync(struct file *file, loff_t start, loff_t end,
+ int datasync)
struct ovl_dir_file *od = file->private_data;

@@ -400,7 +401,7 @@ static int ovl_dir_fsync(struct file *file, int datasync)
return PTR_ERR(od->realfile);

- return vfs_fsync(od->realfile, datasync);
+ return vfs_fsync_range(od->realfile, start, end, datasync);

static int ovl_dir_release(struct inode *inode, struct file *file)

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/