linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add O_NONBLOCK support to FUSE
@ 2006-03-01  2:29 Jeff Dike
  2006-03-01  9:51 ` Miklos Szeredi
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Dike @ 2006-03-01  2:29 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: fuse-devel, linux-fsdevel, linux-kernel

This adds O_NONBLOCK support to FUSE.
I don't like duplicating the connected and list_empty tests in
fuse_dev_readv, but this seemed cleaner than adding the f_flags test
to request_wait.

Signed-off-by: Jeff Dike <jdike@addtoit.com>

Index: host-2.6.15-fuse/fs/fuse/dev.c
===================================================================
--- host-2.6.15-fuse.orig/fs/fuse/dev.c	2006-02-28 21:00:00.000000000 -0500
+++ host-2.6.15-fuse/fs/fuse/dev.c	2006-02-28 21:04:36.000000000 -0500
@@ -613,6 +613,12 @@ static ssize_t fuse_dev_readv(struct fil
 	err = -EPERM;
 	if (!fc)
 		goto err_unlock;
+
+	err = -EAGAIN;
+	if((file->f_flags & O_NONBLOCK) && fc->connected &&
+	   list_empty(&fc->pending))
+		goto err_unlock;
+
 	request_wait(fc);
 	err = -ENODEV;
 	if (!fc->connected)

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

* Re: [PATCH] Add O_NONBLOCK support to FUSE
  2006-03-01  2:29 [PATCH] Add O_NONBLOCK support to FUSE Jeff Dike
@ 2006-03-01  9:51 ` Miklos Szeredi
  2006-03-02 18:04   ` Jeff Dike
  0 siblings, 1 reply; 4+ messages in thread
From: Miklos Szeredi @ 2006-03-01  9:51 UTC (permalink / raw)
  To: jdike; +Cc: fuse-devel, linux-fsdevel, linux-kernel

Thanks.  Queued both patches.

Miklos

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

* Re: [PATCH] Add O_NONBLOCK support to FUSE
  2006-03-01  9:51 ` Miklos Szeredi
@ 2006-03-02 18:04   ` Jeff Dike
  2006-03-02 19:56     ` Miklos Szeredi
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Dike @ 2006-03-02 18:04 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: fuse-devel, linux-fsdevel, linux-kernel

Found the BUG, patch below.  Feel free to merge it with the async
patch even though it is signed off on its own.

				Jeff

I didn't realize that kobject_put(&fc->kobj) freed fc.

Signed-off-by: Jeff Dike <jdike@addtoit.com>

Index: host-2.6.15-fuse/fs/fuse/dev.c
===================================================================
--- host-2.6.15-fuse.orig/fs/fuse/dev.c	2006-03-01 14:08:40.000000000 -0500
+++ host-2.6.15-fuse/fs/fuse/dev.c	2006-03-01 14:09:04.000000000 -0500
@@ -919,9 +919,9 @@ static int fuse_dev_release(struct inode
 	}
 	spin_unlock(&fuse_lock);
 	if (fc) {
-		kobject_put(&fc->kobj);
 		fasync_helper(-1, file, 0, &fc->fasync);
 		fc->fasync = NULL;
+		kobject_put(&fc->kobj);
 	}
 
 	return 0;

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

* Re: [PATCH] Add O_NONBLOCK support to FUSE
  2006-03-02 18:04   ` Jeff Dike
@ 2006-03-02 19:56     ` Miklos Szeredi
  0 siblings, 0 replies; 4+ messages in thread
From: Miklos Szeredi @ 2006-03-02 19:56 UTC (permalink / raw)
  To: jdike; +Cc: fuse-devel, linux-fsdevel, linux-kernel

> Found the BUG, patch below.  Feel free to merge it with the async
> patch even though it is signed off on its own.

OK.

And I think the 'fc->fasync = NULL' is redundant, since
fasync_helper() should have already set it to NULL (fc->fasync list
will contain at most one item).

Committed both changes.

Miklos

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

end of thread, other threads:[~2006-03-02 19:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-01  2:29 [PATCH] Add O_NONBLOCK support to FUSE Jeff Dike
2006-03-01  9:51 ` Miklos Szeredi
2006-03-02 18:04   ` Jeff Dike
2006-03-02 19: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).