aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMaxim Patlasov <mpatlasov@parallels.com>2013-03-21 10:02:15 -0400
committerMiklos Szeredi <mszeredi@suse.cz>2013-04-17 06:31:44 -0400
commit796523fb24028639c007f71e02ca21730f7c0af6 (patch)
treec898b0bd8933078bdb16bd1c35a4a1cd7d074a06 /fs
parent8b41e6715ed555e2d8e8dac52ec1f05a9f04dcb4 (diff)
fuse: add flag fc->initialized
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/fuse/cuse.c1
-rw-r--r--fs/fuse/dev.c1
-rw-r--r--fs/fuse/fuse_i.h4
-rw-r--r--fs/fuse/inode.c3
4 files changed, 9 insertions, 0 deletions
diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
index b7c7f3060635..f563e78852b7 100644
--- a/fs/fuse/cuse.c
+++ b/fs/fuse/cuse.c
@@ -505,6 +505,7 @@ static int cuse_channel_open(struct inode *inode, struct file *file)
505 505
506 cc->fc.connected = 1; 506 cc->fc.connected = 1;
507 cc->fc.blocked = 0; 507 cc->fc.blocked = 0;
508 cc->fc.initialized = 1;
508 rc = cuse_send_init(cc); 509 rc = cuse_send_init(cc);
509 if (rc) { 510 if (rc) {
510 fuse_conn_put(&cc->fc); 511 fuse_conn_put(&cc->fc);
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 3b8301f5c0e1..39c2fe3ba93d 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -2087,6 +2087,7 @@ void fuse_abort_conn(struct fuse_conn *fc)
2087 if (fc->connected) { 2087 if (fc->connected) {
2088 fc->connected = 0; 2088 fc->connected = 0;
2089 fc->blocked = 0; 2089 fc->blocked = 0;
2090 fc->initialized = 1;
2090 end_io_requests(fc); 2091 end_io_requests(fc);
2091 end_queued_requests(fc); 2092 end_queued_requests(fc);
2092 end_polls(fc); 2093 end_polls(fc);
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 47c94d28ff88..6bf30f2af901 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -417,6 +417,10 @@ struct fuse_conn {
417 /** Batching of FORGET requests (positive indicates FORGET batch) */ 417 /** Batching of FORGET requests (positive indicates FORGET batch) */
418 int forget_batch; 418 int forget_batch;
419 419
420 /** Flag indicating that INIT reply has been received. Allocating
421 * any fuse request will be suspended until the flag is set */
422 int initialized;
423
420 /** Flag indicating if connection is blocked. This will be 424 /** Flag indicating if connection is blocked. This will be
421 the case before the INIT reply is received, and if there 425 the case before the INIT reply is received, and if there
422 are too many outstading backgrounds requests */ 426 are too many outstading backgrounds requests */
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index e26607df93df..4958f8099f16 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -363,6 +363,7 @@ void fuse_conn_kill(struct fuse_conn *fc)
363 spin_lock(&fc->lock); 363 spin_lock(&fc->lock);
364 fc->connected = 0; 364 fc->connected = 0;
365 fc->blocked = 0; 365 fc->blocked = 0;
366 fc->initialized = 1;
366 spin_unlock(&fc->lock); 367 spin_unlock(&fc->lock);
367 /* Flush all readers on this fs */ 368 /* Flush all readers on this fs */
368 kill_fasync(&fc->fasync, SIGIO, POLL_IN); 369 kill_fasync(&fc->fasync, SIGIO, POLL_IN);
@@ -583,6 +584,7 @@ void fuse_conn_init(struct fuse_conn *fc)
583 fc->polled_files = RB_ROOT; 584 fc->polled_files = RB_ROOT;
584 fc->reqctr = 0; 585 fc->reqctr = 0;
585 fc->blocked = 1; 586 fc->blocked = 1;
587 fc->initialized = 0;
586 fc->attr_version = 1; 588 fc->attr_version = 1;
587 get_random_bytes(&fc->scramble_key, sizeof(fc->scramble_key)); 589 get_random_bytes(&fc->scramble_key, sizeof(fc->scramble_key));
588} 590}
@@ -882,6 +884,7 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
882 fc->conn_init = 1; 884 fc->conn_init = 1;
883 } 885 }
884 fc->blocked = 0; 886 fc->blocked = 0;
887 fc->initialized = 1;
885 wake_up_all(&fc->blocked_waitq); 888 wake_up_all(&fc->blocked_waitq);
886} 889}
887 890