[Devel,vz7,21/46] fuse: abort: group iqueue accesses

Submitted by Maxim Patlasov on March 25, 2017, 2:20 a.m.

Details

Message ID 149040843010.25341.14435679671520738368.stgit@maxim-thinkpad
State New
Series "fuse: add multi-threading support"
Headers show

Commit Message

Maxim Patlasov March 25, 2017, 2:20 a.m.
Backport from ml:

commit 8c91189a2a8f5e69457bea9f48350c48310cec5b
Author: Miklos Szeredi <mszeredi@suse.cz>
Date:   Wed Jul 1 16:26:02 2015 +0200

    fuse: abort: group iqueue accesses

    Rearrange fuse_abort_conn() so that input queue accesses are grouped
    together.

    Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
    Reviewed-by: Ashish Samant <ashish.samant@oracle.com>

Signed-off-by: Maxim Patlasov <mpatlasov@virtuozzo.com>
---
 fs/fuse/dev.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 816f9e4..7c03d38 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -2122,7 +2122,6 @@  void fuse_abort_conn(struct fuse_conn *fc)
 		LIST_HEAD(to_end2);
 
 		fc->connected = 0;
-		fiq->connected = 0;
 		fc->blocked = 0;
 		fuse_set_initialized(fc);
 		list_for_each_entry_safe(req, next, &fc->io, list) {
@@ -2135,7 +2134,14 @@  void fuse_abort_conn(struct fuse_conn *fc)
 		}
 		fc->max_background = UINT_MAX;
 		flush_bg_queue(fc);
+
+		fiq->connected = 0;
 		list_splice_init(&fiq->pending, &to_end2);
+		while (forget_pending(fiq))
+			kfree(dequeue_forget(fiq, 1, NULL));
+		wake_up_all(&fiq->waitq);
+		kill_fasync(&fiq->fasync, SIGIO, POLL_IN);
+
 		list_splice_init(&fc->processing, &to_end2);
 		while (!list_empty(&to_end1)) {
 			req = list_first_entry(&to_end1, struct fuse_req, list);
@@ -2144,12 +2150,8 @@  void fuse_abort_conn(struct fuse_conn *fc)
 			spin_lock(&fc->lock);
 		}
 		end_requests(fc, &to_end2);
-		while (forget_pending(fiq))
-			kfree(dequeue_forget(fiq, 1, NULL));
 		end_polls(fc);
-		wake_up_all(&fiq->waitq);
 		wake_up_all(&fc->blocked_waitq);
-		kill_fasync(&fiq->fasync, SIGIO, POLL_IN);
 	}
 	spin_unlock(&fc->lock);
 }