[Devel] [RH7 PATCH 1/2] fs: check container odirect and fsync settings in __dentry_open

Dmitry Monakhov dmonakhov at openvz.org
Wed Jun 24 08:30:56 PDT 2015


sys_open for conventional filesystems doesn't call dentry_open,
it calls __dentry_open (in nameidata_to_filp), so we have to move
checks for odirect and fsync behaviour to __dentry_open
to make them working on ploop containers.

https://jira.sw.ru/browse/PSBM-17157

Signed-off-by: Dmitry Guryanov <dguryanov at parallels.com>
Acked-by: Dmitry Monakhov <dmonakhov at openvz.org>
Signed-off-by: Dmitry Monakhov <dmonakhov at openvz.org>
---
 fs/open.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/open.c b/fs/open.c
index 435794f..d64cfad 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -683,6 +683,11 @@ static int do_dentry_open(struct file *f,
 	struct inode *inode;
 	int error;
 
+	if (!may_use_odirect())
+		f->f_flags &= ~O_DIRECT;
+	if (ve_fsync_behavior() == FSYNC_NEVER)
+		f->f_flags &= ~O_SYNC;
+
 	f->f_mode = OPEN_FMODE(f->f_flags) | FMODE_LSEEK |
 				FMODE_PREAD | FMODE_PWRITE;
 
@@ -824,11 +829,6 @@ struct file *dentry_open(const struct path *path, int flags,
 	/* We must always pass in a valid mount pointer. */
 	BUG_ON(!path->mnt);
 
-	if (!may_use_odirect())
-		flags &= ~O_DIRECT;
-	if (ve_fsync_behavior() == FSYNC_NEVER)
-		flags &= ~O_SYNC;
-
 	f = get_empty_filp();
 	if (!IS_ERR(f)) {
 		f->f_flags = flags;
-- 
1.7.1




More information about the Devel mailing list