Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] fuse: check O_DIRECT

Check O_DIRECT and return -EINVAL error in open. dentry_open() also checks
this but only after the open method is called. This patch optimizes away
the unnecessary upcalls in this case.

It could be a correctness issue too: if filesystem has open() with side
effect, then it should fail before doing the open, not after.

Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Miklos Szeredi and committed by
Linus Torvalds
dd190d06 daa35edc

+4
+4
fs/fuse/file.c
··· 23 23 struct fuse_file *ff; 24 24 int err; 25 25 26 + /* VFS checks this, but only _after_ ->open() */ 27 + if (file->f_flags & O_DIRECT) 28 + return -EINVAL; 29 + 26 30 err = generic_file_open(inode, file); 27 31 if (err) 28 32 return err;