Add O_NONBLOCK support to FUSE
Subsystems (2)
PATCH 1/1 Add O_NONBLOCK support to FUSE
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 <[email protected]>
fs/fuse/dev.c +6 -0
@@ -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)
Miklos Szeredi
maintainerThanks. Queued both patches.
Miklos
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 <[email protected]>
fs/fuse/dev.c +1 -1
@@ -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 ;
Miklos Szeredi
maintainerQuoted 2 lines
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