[Devel] [PATCH RHEL7 COMMIT] fs/fuse kio_pcs: remove fuse destroy request

Konstantin Khorenko khorenko at virtuozzo.com
Thu Oct 4 16:20:24 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-862.14.4.vz7.72.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.14.4.vz7.72.2
------>
commit 8d6f767596d8eeaf708b6baf0c4f3a116e28ff5e
Author: Pavel Butsykin <pbutsykin at virtuozzo.com>
Date:   Wed Oct 3 17:08:55 2018 +0300

    fs/fuse kio_pcs: remove fuse destroy request
    
    Not very clear why we need a separate request to call kpcs_conn_fini(). To
    simplify let's use kio hook instead and move it before fuse_abort_conn().
    
    Signed-off-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
    Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    =======================================================
    Patchset description:
    
    RPC connection double close fixes
    
    https://pmc.acronis.com/browse/VSTOR-15378
    
    Pavel Butsykin (3):
      fs/fuse kio_pcs: fix race between req->end() and request_wait_answer()
      fs/fuse kio_pcs: remove fuse destroy request
      fs/fuse kio_pcs: drop rpc connection close in pcs_rpc_engine_fini()
---
 fs/fuse/inode.c                    | 20 +++++---------------
 fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 16 +---------------
 2 files changed, 6 insertions(+), 30 deletions(-)

diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 6b374324f84f..5141651493a3 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -460,19 +460,6 @@ static void fuse_umount_begin(struct super_block *sb)
 	fuse_abort_conn(get_fuse_conn_super(sb));
 }
 
-static void fuse_send_destroy(struct fuse_conn *fc)
-{
-	struct fuse_req *req = fc->destroy_req;
-	if (req && fc->conn_init) {
-		fc->destroy_req = NULL;
-		req->in.h.opcode = FUSE_DESTROY;
-		__set_bit(FR_FORCE, &req->flags);
-		__clear_bit(FR_BACKGROUND, &req->flags);
-		fuse_request_send(fc, req);
-		fuse_put_request(fc, req);
-	}
-}
-
 static void fuse_bdi_destroy(struct fuse_conn *fc)
 {
 	if (fc->bdi_initialized)
@@ -535,9 +522,12 @@ static void fuse_put_super(struct super_block *sb)
 {
 	struct fuse_conn *fc = get_fuse_conn_super(sb);
 
-	fuse_send_destroy(fc);
-
 	fuse_abort_conn(fc);
+
+	if (fc->kio.op) { /* At this point all pending kio must be completed. */
+		fc->kio.op->conn_fini(fc);
+		fc->kio.ctx = NULL;
+	}
 	mutex_lock(&fuse_mutex);
 	list_del(&fc->entry);
 	fuse_ctl_remove_conn(fc);
diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
index 85ede13a6ebe..431df2419e65 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -173,12 +173,7 @@ void kpcs_conn_fini(struct fuse_conn *fc)
 
 void kpcs_conn_abort(struct fuse_conn *fc)
 {
-	if (!fc->kio.ctx)
-		return;
-
-	//pcs_cluster_fini((struct pcs_fuse_cluster *) fc->kio.ctx);
-	printk("%s TODO: implement this method\n", __FUNCTION__);
-
+	/* XXX: Implement abort pending kio */
 }
 
 static int kpcs_probe(struct fuse_conn *fc, char *name)
@@ -1028,15 +1023,6 @@ static int kpcs_req_send(struct fuse_conn* fc, struct fuse_req *req, bool bg, bo
 
 	TRACE(" Enter req:%p op:%d end:%p bg:%d lk:%d\n", req, req->in.h.opcode, req->end, bg, lk);
 
-	/* TODO: This is just a crunch, Conn cleanup requires sane locking */
-	if (req->in.h.opcode == FUSE_DESTROY) {
-		kpcs_conn_fini(fc);
-		spin_lock(&fc->lock);
-		fc->kio.ctx = NULL;
-		spin_unlock(&fc->lock);
-		return 1;
-	}
-
 	if (!fi || !fi->private)
 		return 1;
 



More information about the Devel mailing list