linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/3] fuse: check O_DIRECT
@ 2005-09-23 14:21 Miklos Szeredi
  2005-09-23 21:27 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Miklos Szeredi @ 2005-09-23 14:21 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel

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.

Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>

Index: linux/fs/fuse/file.c
===================================================================
--- linux.orig/fs/fuse/file.c	2005-09-21 11:55:45.000000000 +0200
+++ linux/fs/fuse/file.c	2005-09-23 15:24:23.000000000 +0200
@@ -23,6 +23,10 @@ int fuse_open_common(struct inode *inode
 	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;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 3/3] fuse: check O_DIRECT
  2005-09-23 14:21 [PATCH 3/3] fuse: check O_DIRECT Miklos Szeredi
@ 2005-09-23 21:27 ` Andrew Morton
  2005-09-24  5:56   ` Miklos Szeredi
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2005-09-23 21:27 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: linux-kernel

Miklos Szeredi <miklos@szeredi.hu> wrote:
>
> 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.
> 
> Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
> 
> Index: linux/fs/fuse/file.c
> ===================================================================
> --- linux.orig/fs/fuse/file.c	2005-09-21 11:55:45.000000000 +0200
> +++ linux/fs/fuse/file.c	2005-09-23 15:24:23.000000000 +0200
> @@ -23,6 +23,10 @@ int fuse_open_common(struct inode *inode
>  	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;

This hardly seems worth optimising for?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 3/3] fuse: check O_DIRECT
  2005-09-23 21:27 ` Andrew Morton
@ 2005-09-24  5:56   ` Miklos Szeredi
  0 siblings, 0 replies; 3+ messages in thread
From: Miklos Szeredi @ 2005-09-24  5:56 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel

> > +	/* 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;
> 
> This hardly seems worth optimising for?

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

Not a big deal, but I think it's worth the 3 lines.

Miklos

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-09-24  5:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-23 14:21 [PATCH 3/3] fuse: check O_DIRECT Miklos Szeredi
2005-09-23 21:27 ` Andrew Morton
2005-09-24  5:56   ` Miklos Szeredi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).