[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100906005029.20775.56925.stgit@localhost.localdomain>
Date: Mon, 06 Sep 2010 10:50:29 +1000
From: NeilBrown <neilb@...e.de>
To: Miklos Szeredi <miklos@...redi.hu>
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
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@...e.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)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists