From: Miklos Szeredi The ->connected flag for a fuse_conn object previously only indicated whether the device file for this connection is currently open or not. Change it's meaning so that it indicates whether the connection is active or not: now either umount or device release will clear the flag. The separate ->mounted flag is still needed for handling background requests. Signed-off-by: Miklos Szeredi Signed-off-by: Andrew Morton --- fs/fuse/dev.c | 6 +++--- fs/fuse/fuse_i.h | 3 ++- fs/fuse/inode.c | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff -puN fs/fuse/dev.c~fuse-extend-semantics-of-connected-flag fs/fuse/dev.c --- 25/fs/fuse/dev.c~fuse-extend-semantics-of-connected-flag Fri Jan 13 17:35:51 2006 +++ 25-akpm/fs/fuse/dev.c Fri Jan 13 17:35:51 2006 @@ -26,7 +26,7 @@ static struct fuse_conn *fuse_get_conn(s struct fuse_conn *fc; spin_lock(&fuse_lock); fc = file->private_data; - if (fc && !fc->mounted) + if (fc && !fc->connected) fc = NULL; spin_unlock(&fuse_lock); return fc; @@ -594,7 +594,7 @@ static void request_wait(struct fuse_con DECLARE_WAITQUEUE(wait, current); add_wait_queue_exclusive(&fc->waitq, &wait); - while (fc->mounted && list_empty(&fc->pending)) { + while (fc->connected && list_empty(&fc->pending)) { set_current_state(TASK_INTERRUPTIBLE); if (signal_pending(current)) break; @@ -634,7 +634,7 @@ static ssize_t fuse_dev_readv(struct fil goto err_unlock; request_wait(fc); err = -ENODEV; - if (!fc->mounted) + if (!fc->connected) goto err_unlock; err = -ERESTARTSYS; if (list_empty(&fc->pending)) diff -puN fs/fuse/fuse_i.h~fuse-extend-semantics-of-connected-flag fs/fuse/fuse_i.h --- 25/fs/fuse/fuse_i.h~fuse-extend-semantics-of-connected-flag Fri Jan 13 17:35:51 2006 +++ 25-akpm/fs/fuse/fuse_i.h Fri Jan 13 17:35:51 2006 @@ -249,7 +249,8 @@ struct fuse_conn { /** Mount is active */ unsigned mounted : 1; - /** Connection established */ + /** Connection established, cleared on umount and device + release */ unsigned connected : 1; /** Connection failed (version mismatch) */ diff -puN fs/fuse/inode.c~fuse-extend-semantics-of-connected-flag fs/fuse/inode.c --- 25/fs/fuse/inode.c~fuse-extend-semantics-of-connected-flag Fri Jan 13 17:35:51 2006 +++ 25-akpm/fs/fuse/inode.c Fri Jan 13 17:35:51 2006 @@ -200,6 +200,7 @@ static void fuse_put_super(struct super_ spin_lock(&fuse_lock); fc->mounted = 0; + fc->connected = 0; /* Flush all readers on this fs */ wake_up_all(&fc->waitq); up_write(&fc->sbput_sem); _