[Devel] [PATCH hci-8.1 v2] fs/fuse kio: drop the done parameter of rio_msg_sent()

Konstantin Khorenko khorenko at virtuozzo.com
Tue Sep 29 20:38:14 MSK 2026


The tx and done parameters are mutually exclusive:
 * done == 1 ignores tx
 * done == 0 requires it

Let tx == NULL mean the message is complete instead. This also stops
rio_submit() from passing an uninitialized tx on the PCS_MSG_ABORTED
path (harmless, the done branch never read it).

https://virtuozzo.atlassian.net/browse/VSTOR-141673

Feature: vStorage
Suggested-by: Liu Kui <kui.liu at virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
Changes in v2:
- droppped: fs/fuse kio: unlink the tx before completing its msg on RDMA_READ_ACK
- Link to v1: http://lore.virtuozzo.com/20260928-prep-kh-vstor-141673-kio-read-ack-order-v1-1-6069e78cac95@virtuozzo.com
---
 fs/fuse/kio/pcs/pcs_rdma_io.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/fs/fuse/kio/pcs/pcs_rdma_io.c b/fs/fuse/kio/pcs/pcs_rdma_io.c
index 2001297010a64..59a3c1286363d 100644
--- a/fs/fuse/kio/pcs/pcs_rdma_io.c
+++ b/fs/fuse/kio/pcs/pcs_rdma_io.c
@@ -151,9 +151,10 @@ static struct pcs_msg *rio_dequeue_reserved_msg(struct pcs_rdmaio *rio)
 	return msg;
 }
 
-static void rio_msg_sent(struct pcs_rdmaio *rio, struct rio_tx *tx, struct pcs_msg *msg, int done)
+/* tx == NULL means the message is complete, no tx tracks it anymore */
+static void rio_msg_sent(struct pcs_rdmaio *rio, struct rio_tx *tx, struct pcs_msg *msg)
 {
-	if (done) {
+	if (!tx) {
 		clear_and_wake_up_bit(PCS_MSG_BUSY, &msg->flags);
 		pcs_msg_sent(msg);
 		msg->done(msg);
@@ -630,7 +631,7 @@ static int rio_submit(struct pcs_rdmaio *rio, struct pcs_msg *msg, int type, u64
 
 		if (unlikely(test_bit(PCS_MSG_ABORTED, &msg->flags))) {
 			pcs_set_local_error(&msg->error, PCS_ERR_CANCEL_REQUEST);
-			rio_msg_sent(rio, tx, msg, 1);
+			rio_msg_sent(rio, NULL, msg);
 			return 0;
 		}
 	}
@@ -725,7 +726,7 @@ static int rio_submit(struct pcs_rdmaio *rio, struct pcs_msg *msg, int type, u64
 		 * in a single RX queue are guaranteed to come in order, there
 		 * is no race in this case.
 		 */
-		rio_msg_sent(rio, tx, msg, rb == NULL);
+		rio_msg_sent(rio, rb ? tx : NULL, msg);
 	}
 
 	return 0;
@@ -928,7 +929,7 @@ static int rio_handle_rx_read_ack(struct pcs_rdmaio *rio,
 
 	list_for_each_entry(tx, &rio->active_txs, list)
 		if (tx->xid == rack->xid) {
-			rio_msg_sent(rio, NULL, tx->msg, 1);
+			rio_msg_sent(rio, NULL, tx->msg);
 			tx->msg = NULL;
 			list_del(&tx->list);
 			rio_handle_tx(rio, tx, !rack->status);
@@ -1428,7 +1429,7 @@ static void rio_cleanup(struct pcs_rdmaio *rio)
 		BUG_ON(!msg);
 		rio_put_tx(rio->dev, tx);
 		pcs_set_local_error(&msg->error, rio->rio_error);
-		rio_msg_sent(rio, NULL, msg, 1);
+		rio_msg_sent(rio, NULL, msg);
 	}
 }
 

---
base-commit: 0679f0d70523972eec3a0643565521d93e26eb9c
change-id: 20260928-prep-kh-vstor-141673-kio-read-ack-order-9fc2b40d4077

Best regards,
--  
Konstantin Khorenko <khorenko at virtuozzo.com>



More information about the Devel mailing list