projects/linux·commit e5ac1d1e

[PATCH] fuse: add O_NONBLOCK support to FUSE device

e5ac1d1e · Jeff Dike <[email protected]> · 2006-04-10 22:54:53 -07:00

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]>
Signed-off-by: Miklos Szeredi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Commit
e5ac1d1e70a8c19a65a959d73650203df7a2e168
Parents
385a17bf

Changes

1 files changed · +6 −0

FileStatusAddDelContent
fs/fuse/dev.cmodified+6−0View file

fs/fuse/dev.c

View file
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 438770f..75c6e91 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -619,6 +619,12 @@ static ssize_t fuse_dev_readv(struct file *file, const struct iovec *iov,
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)