[Devel,vz7,02/46] fuse: fix background request if not connected

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

Details

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

Commit Message

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

commit 42dc6211c54aa93e6a483469d07bd06f91713af7
Author: Miklos Szeredi <mszeredi@suse.cz>
Date:   Wed Jul 1 16:25:56 2015 +0200

    fuse: fix background request if not connected

    request_end() expects fc->num_background and fc->active_background to have
    been incremented, which is not the case in fuse_request_send_nowait()
    failure path.  So instead just call the ->end() callback (which is actually
    set by all callers).

    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 |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index d6029ca..6022969 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -529,6 +529,7 @@  static void fuse_request_send_nowait_locked(struct fuse_conn *fc,
 
 static void fuse_request_send_nowait(struct fuse_conn *fc, struct fuse_req *req)
 {
+	BUG_ON(!req->end);
 	spin_lock(&fc->lock);
 	if (req->page_cache && req->ff &&
 	    test_bit(FUSE_S_FAIL_IMMEDIATELY, &req->ff->ff_state)) {
@@ -540,8 +541,10 @@  static void fuse_request_send_nowait(struct fuse_conn *fc, struct fuse_req *req)
 		fuse_request_send_nowait_locked(fc, req);
 		spin_unlock(&fc->lock);
 	} else {
+		spin_unlock(&fc->lock);
 		req->out.h.error = -ENOTCONN;
-		request_end(fc, req);
+		req->end(fc, req);
+		fuse_put_request(fc, req);
 	}
 }