lkml.org 
[lkml]   [2010]   [Sep]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH 05/10] ovl: make sure fsync is never called on the lower filesystem.
If we open a directory O_RDONLY, ->realfile could be on the lower
filesystem.
While fsync is not likely to be called on such a file, we should make
sure never to pass the fsync down as we are treating the lower
filesystem as read-only.

Signed-off-by: NeilBrown <neilb@suse.de>
---
fs/overlayfs/overlayfs.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/fs/overlayfs/overlayfs.c b/fs/overlayfs/overlayfs.c
index de854e1..f9eea96 100644
--- a/fs/overlayfs/overlayfs.c
+++ b/fs/overlayfs/overlayfs.c
@@ -329,8 +329,15 @@ static loff_t ovl_dir_llseek(struct file *file, loff_t offset, int origin)
static int ovl_dir_fsync(struct file *file, int datasync)
{
struct ovl_dir_file *od = file->private_data;
+ struct ovl_entry *ue = file->f_path.dentry->d_fsdata;

- return vfs_fsync(od->realfile, datasync);
+ /* realfile could be on lowerdir, but only if this was a read-only open,
+ * in which case we can ignore the fsync.
+ */
+ if (file->f_path.dentry == ue->upperpath.dentry)
+ return vfs_fsync(od->realfile, datasync);
+ else
+ return 0;
}

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



\
 
 \ /
  Last update: 2010-09-06 02:55    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site