[Devel] [PATCH RHEL7 COMMIT] fuse kio: Introduce pcs_sk_kick_queue()

Konstantin Khorenko khorenko at virtuozzo.com
Tue Oct 16 18:09:43 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.9
------>
commit 73f8d1e0a0d8b94253ce73d8793cb5fcee7acb6f
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Tue Oct 16 18:09:42 2018 +0300

    fuse kio: Introduce pcs_sk_kick_queue()
    
    This is refactoring to combine almost repeating code
    in one function
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    Reviewed-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
    
    =====================
    Patchset description:
    
    Order pcs_rpc and pcs_sockio destruction and close leaked socket
    
    https://pmc.acronis.com/browse/VSTOR-15305
    
    Ploop can asynchronously unmap regions by sending IOCB_CMD_UNMAP_ITER, but this
    command isn't quite correctly interpreted in Fuse. Moreover, in Fast-path mode,
    fallocate(FALLOC_FL_PUNCH_HOLE|FALLOC_FL_ZERO_RANGE) falls to fuse user daemon
    and it can lead to data corruption.
    
    Let's fix it.
    
    Kirill Tkhai (9):
          fuse kio: Use __maybe_unused
          fuse kio: Use sio eof instead of parent to determ abort
          fuse kio: Reorder callback assignment
          fuse kio: Add pcs_cleanup_wq
          fuse kio: Destroy rpc in work func
          fuse kio: Introduce pcs_sk_kick_queue()
          fuse kio: Dereference sk_user_data under rcu
          fuse kio: Fix rpc socket leak on rpc_abort()
          fuse kio: Hold pcs_rpc counter till sio may be freed
---
 fs/fuse/kio/pcs/pcs_sock_io.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/fs/fuse/kio/pcs/pcs_sock_io.c b/fs/fuse/kio/pcs/pcs_sock_io.c
index 44c49b63f5d1..d99046f05834 100644
--- a/fs/fuse/kio/pcs/pcs_sock_io.c
+++ b/fs/fuse/kio/pcs/pcs_sock_io.c
@@ -494,24 +494,25 @@ void pcs_sock_ioconn_destruct(struct pcs_ioconn *ioconn)
 	kfree(sio);
 }
 
-static void pcs_sk_data_ready(struct sock *sk, int count)
+static void pcs_sk_kick_queue(struct sock *sk)
 {
-	struct pcs_sockio *sio = sk->sk_user_data;
-	struct pcs_rpc *ep = sio->parent;
+	struct pcs_sockio *sio;
 
-	TRACE(PEER_FMT" queue count:%d \n", PEER_ARGS(ep), count);
+	sio = sk->sk_user_data;;
+	if (sio) {
+		struct pcs_rpc *ep = sio->parent;
+		TRACE(PEER_FMT" queue\n", PEER_ARGS(ep));
+		pcs_rpc_kick_queue(ep);
+	}
+}
 
-	pcs_rpc_kick_queue(ep);
+static void pcs_sk_data_ready(struct sock *sk, int count)
+{
+	pcs_sk_kick_queue(sk);
 }
 static void pcs_sk_write_space(struct sock *sk)
 {
-	struct pcs_sockio *sio = sk->sk_user_data;
-	struct pcs_rpc *ep = sio->parent;
-
-	TRACE(PEER_FMT" queue \n", PEER_ARGS(ep));
-
-	pcs_rpc_kick_queue(ep);
-
+	pcs_sk_kick_queue(sk);
 }
 
 /* TODO this call back does not look correct, sane locking/error handling is required */



More information about the Devel mailing list