]> git.karo-electronics.de Git - linux-beck.git/commitdiff
fuse: add flag fc->initialized
authorMaxim Patlasov <mpatlasov@parallels.com>
Thu, 21 Mar 2013 14:02:15 +0000 (18:02 +0400)
committerMiklos Szeredi <mszeredi@suse.cz>
Wed, 17 Apr 2013 10:31:44 +0000 (12:31 +0200)
Existing flag fc->blocked is used to suspend request allocation both in case
of many background request submitted and period of time before init_reply
arrives from userspace. Next patch will skip blocking allocations of
synchronous request (disregarding fc->blocked). This is mostly OK, but
we still need to suspend allocations if init_reply is not arrived yet. The
patch introduces flag fc->initialized which will serve this purpose.

Signed-off-by: Maxim Patlasov <mpatlasov@parallels.com>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
fs/fuse/cuse.c
fs/fuse/dev.c
fs/fuse/fuse_i.h
fs/fuse/inode.c

index b7c7f30606357828b9e9974fcb95c23aa279e091..f563e78852b73eed3b708f693b3204065cb68bdc 100644 (file)
@@ -505,6 +505,7 @@ static int cuse_channel_open(struct inode *inode, struct file *file)
 
        cc->fc.connected = 1;
        cc->fc.blocked = 0;
+       cc->fc.initialized = 1;
        rc = cuse_send_init(cc);
        if (rc) {
                fuse_conn_put(&cc->fc);
index 3b8301f5c0e1d1937db7f2d8a980e55459fd519b..39c2fe3ba93d07e20cc06277a6d0cc00e6b5576c 100644 (file)
@@ -2087,6 +2087,7 @@ void fuse_abort_conn(struct fuse_conn *fc)
        if (fc->connected) {
                fc->connected = 0;
                fc->blocked = 0;
+               fc->initialized = 1;
                end_io_requests(fc);
                end_queued_requests(fc);
                end_polls(fc);
index 47c94d28ff888552749c30edcacbf06a63d56714..6bf30f2af9019f286dec4c44aa374e76d7ff2b15 100644 (file)
@@ -417,6 +417,10 @@ struct fuse_conn {
        /** Batching of FORGET requests (positive indicates FORGET batch) */
        int forget_batch;
 
+       /** Flag indicating that INIT reply has been received. Allocating
+        * any fuse request will be suspended until the flag is set */
+       int initialized;
+
        /** Flag indicating if connection is blocked.  This will be
            the case before the INIT reply is received, and if there
            are too many outstading backgrounds requests */
index e26607df93df9c5e5cac7cc7408ccbd7ba67b8fe..4958f8099f16e1d73cfa9427d80d227298d8b712 100644 (file)
@@ -363,6 +363,7 @@ void fuse_conn_kill(struct fuse_conn *fc)
        spin_lock(&fc->lock);
        fc->connected = 0;
        fc->blocked = 0;
+       fc->initialized = 1;
        spin_unlock(&fc->lock);
        /* Flush all readers on this fs */
        kill_fasync(&fc->fasync, SIGIO, POLL_IN);
@@ -583,6 +584,7 @@ void fuse_conn_init(struct fuse_conn *fc)
        fc->polled_files = RB_ROOT;
        fc->reqctr = 0;
        fc->blocked = 1;
+       fc->initialized = 0;
        fc->attr_version = 1;
        get_random_bytes(&fc->scramble_key, sizeof(fc->scramble_key));
 }
@@ -882,6 +884,7 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
                fc->conn_init = 1;
        }
        fc->blocked = 0;
+       fc->initialized = 1;
        wake_up_all(&fc->blocked_waitq);
 }