Skip to content

Commit

Permalink
[PATCH] fuse: check O_DIRECT
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Miklos Szeredi authored and Linus Torvalds committed Sep 30, 2005
1 parent daa35ed commit dd190d0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/fuse/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ int fuse_open_common(struct inode *inode, struct file *file, int isdir)
struct fuse_file *ff;
int err;

/* VFS checks this, but only _after_ ->open() */
if (file->f_flags & O_DIRECT)
return -EINVAL;

err = generic_file_open(inode, file);
if (err)
return err;
Expand Down

0 comments on commit dd190d0

Please sign in to comment.