[RHEL7,COMMIT] fuse: Move FUSE_DESTROY request handling in conn_abort

Submitted by Konstantin Khorenko on June 15, 2018, 12:04 p.m.

Details

Message ID 201806151204.w5FC4kD4010135@finist_ce7.work
State New
Series "fuse: Move FUSE_DESTROY request handling in conn_abort"
Headers show

Commit Message

Konstantin Khorenko June 15, 2018, 12:04 p.m.
The commit is pushed to "branch-rh7-3.10.0-693.21.1.vz7.50.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.21.1.vz7.50.9
------>
commit 58d18acf7cd024dbb5fe8c11c2829c10521b387f
Author: Kirill Tkhai <ktkhai@virtuozzo.com>
Date:   Fri Jun 15 15:04:46 2018 +0300

    fuse: Move FUSE_DESTROY request handling in conn_abort
    
    This commit unifies connection destruction, and
    and moves kpcs_conn_fini() to fuse_abort_conn().
    
    Note, that there are no principal changes. We had:
    
    fuse_put_super()
      fuse_send_destroy()
        req->in.h.opcode = FUSE_DESTROY
        fuse_request_send(req)
      fuse_abort_conn()
    
    Now we moved it to one function down.
    
    The only change is now we call kpcs_conn_fini() after
    standard fuse queues destruction. But it seems nothing
    is touched by this.
    
    This unifies all destruction paths and makes the code
    not crumble in the small pieces of corner cases.
    
    Note, that it may be not a final place of conn_abort()
    in fuse_abort_conn(). Later it may require to move it
    before standard fuse abort (i.e., at the top of
    fuse_abort_conn()), but we decide this later how
    the accurate design of destruction will require to do.
    
    Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
    Reviewed-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
---
 fs/fuse/dev.c                      |  5 +++--
 fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 17 +++++------------
 2 files changed, 8 insertions(+), 14 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index a958783ee113..96d6db217570 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -2210,8 +2210,6 @@  void fuse_abort_conn(struct fuse_conn *fc)
 			list_splice_init(&fpq->processing, &to_end2);
 			spin_unlock(&fpq->lock);
 		}
-		if (fc->kio.op)
-			fc->kio.op->conn_abort(fc);
 
 		fc->max_background = UINT_MAX;
 		for_each_online_cpu(cpu)
@@ -2233,6 +2231,9 @@  void fuse_abort_conn(struct fuse_conn *fc)
 			request_end(fc, req);
 		}
 		end_requests(fc, &to_end2);
+
+		if (fc->kio.op)
+			fc->kio.op->conn_abort(fc);
 	} else {
 		spin_unlock(&fc->lock);
 	}
diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
index af82b043f786..797f07be7a82 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -148,9 +148,11 @@  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__);
-
+	/* TODO: This is just a crunch, Conn cleanup requires sane locking */
+	kpcs_conn_fini(fc);
+	spin_lock(&fc->lock);
+	fc->kio.ctx = NULL;
+	spin_unlock(&fc->lock);
 }
 
 static int kpcs_probe(struct fuse_conn *fc, char *name)
@@ -1002,15 +1004,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;