[PATCH] fuse: extend semantics of connected flag

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 <miklos@szeredi.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Miklos Szeredi and committed by
Linus Torvalds
9ba7cbba d77a1d5b

+6 -4
+3 -3
fs/fuse/dev.c
··· 26 struct fuse_conn *fc; 27 spin_lock(&fuse_lock); 28 fc = file->private_data; 29 - if (fc && !fc->mounted) 30 fc = NULL; 31 spin_unlock(&fuse_lock); 32 return fc; ··· 594 DECLARE_WAITQUEUE(wait, current); 595 596 add_wait_queue_exclusive(&fc->waitq, &wait); 597 - while (fc->mounted && list_empty(&fc->pending)) { 598 set_current_state(TASK_INTERRUPTIBLE); 599 if (signal_pending(current)) 600 break; ··· 634 goto err_unlock; 635 request_wait(fc); 636 err = -ENODEV; 637 - if (!fc->mounted) 638 goto err_unlock; 639 err = -ERESTARTSYS; 640 if (list_empty(&fc->pending))
··· 26 struct fuse_conn *fc; 27 spin_lock(&fuse_lock); 28 fc = file->private_data; 29 + if (fc && !fc->connected) 30 fc = NULL; 31 spin_unlock(&fuse_lock); 32 return fc; ··· 594 DECLARE_WAITQUEUE(wait, current); 595 596 add_wait_queue_exclusive(&fc->waitq, &wait); 597 + while (fc->connected && list_empty(&fc->pending)) { 598 set_current_state(TASK_INTERRUPTIBLE); 599 if (signal_pending(current)) 600 break; ··· 634 goto err_unlock; 635 request_wait(fc); 636 err = -ENODEV; 637 + if (!fc->connected) 638 goto err_unlock; 639 err = -ERESTARTSYS; 640 if (list_empty(&fc->pending))
+2 -1
fs/fuse/fuse_i.h
··· 249 /** Mount is active */ 250 unsigned mounted : 1; 251 252 - /** Connection established */ 253 unsigned connected : 1; 254 255 /** Connection failed (version mismatch) */
··· 249 /** Mount is active */ 250 unsigned mounted : 1; 251 252 + /** Connection established, cleared on umount and device 253 + release */ 254 unsigned connected : 1; 255 256 /** Connection failed (version mismatch) */
+1
fs/fuse/inode.c
··· 200 201 spin_lock(&fuse_lock); 202 fc->mounted = 0; 203 /* Flush all readers on this fs */ 204 wake_up_all(&fc->waitq); 205 up_write(&fc->sbput_sem);
··· 200 201 spin_lock(&fuse_lock); 202 fc->mounted = 0; 203 + fc->connected = 0; 204 /* Flush all readers on this fs */ 205 wake_up_all(&fc->waitq); 206 up_write(&fc->sbput_sem);