Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932148AbWCaRsq (ORCPT ); Fri, 31 Mar 2006 12:48:46 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932152AbWCaRsq (ORCPT ); Fri, 31 Mar 2006 12:48:46 -0500 Received: from a1819.adsl.pool.eol.hu ([81.0.120.41]:46498 "EHLO dorka.pomaz.szeredi.hu") by vger.kernel.org with ESMTP id S932148AbWCaRsp (ORCPT ); Fri, 31 Mar 2006 12:48:45 -0500 To: akpm@osdl.org CC: linux-kernel@vger.kernel.org In-reply-to: (message from Miklos Szeredi on Fri, 31 Mar 2006 19:45:19 +0200) Subject: [PATCH 2/10] fuse: fix fuse_dev_poll() return value References: Message-Id: From: Miklos Szeredi Date: Fri, 31 Mar 2006 19:48:33 +0200 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1400 Lines: 41 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 Index: linux/fs/fuse/dev.c =================================================================== --- linux.orig/fs/fuse/dev.c 2006-03-31 18:55:11.000000000 +0200 +++ linux/fs/fuse/dev.c 2006-03-31 18:55:30.000000000 +0200 @@ -804,17 +804,18 @@ static ssize_t fuse_dev_write(struct fil 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; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/