[PATCH] fuse: extend semantics of connected flag
authorMiklos Szeredi <miklos@szeredi.hu>
Tue, 17 Jan 2006 06:14:34 +0000 (22:14 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 17 Jan 2006 07:15:30 +0000 (23:15 -0800)
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>
fs/fuse/dev.c
fs/fuse/fuse_i.h
fs/fuse/inode.c

index 609875dbd212ca3e0c5ec0f680278f95a6eaa543..5cd43bf917a43b742976ffecdd7dd000e68328ca 100644 (file)
@@ -26,7 +26,7 @@ static struct fuse_conn *fuse_get_conn(struct file *file)
        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_conn *fc)
        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 file *file, const struct iovec *iov,
                goto err_unlock;
        request_wait(fc);
        err = -ENODEV;
-       if (!fc->mounted)
+       if (!fc->connected)
                goto err_unlock;
        err = -ERESTARTSYS;
        if (list_empty(&fc->pending))
index 5742253164d91ac02df1dcd2f60984cf41a00713..e824a09d3151e93125e17dcd3b317b44ddbf7ddd 100644 (file)
@@ -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) */
index d7aaffe979dd20f73b9f71fb1ed1a5a38e63d50d..d6a09fdaa941c90fb4de692edc792b5c380fed74 100644 (file)
@@ -200,6 +200,7 @@ static void fuse_put_super(struct super_block *sb)
 
        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);