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