diff mbox series

[3/7] fuse: Drop and reacquire fc->lock in middle of fuse_abort_conn()

Message ID 154754757079.4244.14375895153780525981.stgit@localhost.localdomain (mailing list archive)
State New, archived
Headers show
Series fuse: Improve disconnect scheme and avoid taking fpq->lock on hot paths | expand

Commit Message

Kirill Tkhai Jan. 15, 2019, 10:19 a.m. UTC
Preparation for next patches.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 fs/fuse/dev.c    |    7 +++++++
 fs/fuse/fuse_i.h |    3 +++
 2 files changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index dd8f019447a9..b393fbedcc1f 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -2231,11 +2231,18 @@  void fuse_abort_conn(struct fuse_conn *fc)
 		kill_fasync(&fiq->fasync, SIGIO, POLL_IN);
 		end_polls(fc);
 		wake_up_all(&fc->blocked_waitq);
+		fc->aborting = true;
 		spin_unlock(&fc->lock);
 
 		end_requests(fc, &to_end);
+
+		spin_lock(&fc->lock);
+		fc->aborting = false;
+		spin_unlock(&fc->lock);
+		wake_up_all(&fc->blocked_waitq);
 	} else {
 		spin_unlock(&fc->lock);
+		wait_event(fc->blocked_waitq, !fc->aborting);
 	}
 }
 EXPORT_SYMBOL_GPL(fuse_abort_conn);
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 033e30af519f..b5f2265c437c 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -587,6 +587,9 @@  struct fuse_conn {
 	    abort and device release */
 	unsigned connected;
 
+	/** Connection abort is in process */
+	bool aborting;
+
 	/** Connection aborted via sysfs */
 	bool aborted;