summaryrefslogtreecommitdiffstats
path: root/fs/fuse
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2006-04-11 07:54:50 +0200
committerLinus Torvalds <torvalds@g5.osdl.org>2006-04-11 15:18:47 +0200
commit7025d9ad10a38dadef8b286e0092731c2d3cdc53 (patch)
tree054f5ce4a0b7a0d3793e66f094af4905a68d1896 /fs/fuse
parent[PATCH] fuse: fix oops in fuse_send_readpages() (diff)
downloadlinux-7025d9ad10a38dadef8b286e0092731c2d3cdc53.tar.xz
linux-7025d9ad10a38dadef8b286e0092731c2d3cdc53.zip
[PATCH] fuse: fix fuse_dev_poll() return value
fuse_dev_poll() returned an error value instead of a poll mask. Luckily (or unluckily) -ENODEV does contain the POLLERR bit. There's also a race if filesystem is unmounted between fuse_get_conn() and spin_lock(), in which case this event will be missed by poll(). Signed-off-by: Miklos Szeredi <miklos@szeredi.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/dev.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 23d1f52eb1b8..b2e8613a26d8 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -804,17 +804,18 @@ static ssize_t fuse_dev_write(struct file *file, const char __user *buf,
static unsigned fuse_dev_poll(struct file *file, poll_table *wait)
{
- struct fuse_conn *fc = fuse_get_conn(file);
unsigned mask = POLLOUT | POLLWRNORM;
-
+ struct fuse_conn *fc = fuse_get_conn(file);
if (!fc)
- return -ENODEV;
+ return POLLERR;
poll_wait(file, &fc->waitq, wait);
spin_lock(&fuse_lock);
- if (!list_empty(&fc->pending))
- mask |= POLLIN | POLLRDNORM;
+ if (!fc->connected)
+ mask = POLLERR;
+ else if (!list_empty(&fc->pending))
+ mask |= POLLIN | POLLRDNORM;
spin_unlock(&fuse_lock);
return mask;