[PATCH] fuse: add O_NONBLOCK support to FUSE device
authorJeff Dike <jdike@addtoit.com>
Tue, 11 Apr 2006 05:54:53 +0000 (22:54 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 11 Apr 2006 13:18:48 +0000 (06:18 -0700)
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>
Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/fuse/dev.c

index 438770f8867fc2fe1289472f30fe52103251ab36..75c6e9166c3928e11d6927185eed0683ef046b22 100644 (file)
@@ -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)