[Devel] [PATCH VZ9] fs/fuse kio: add debug info to catch unexpected event

Liu Kui kui.liu at virtuozzo.com
Wed May 28 06:09:20 MSK 2025


We encountered a very strange problem that krpc returns a response
msg without error, however the userspace still sees the original
request msg header in the tx buf instead of the response msg header.
We don't know how it happened, as there's no info from kernel. So
here we try to catch such event by printing a warn message only,
letting userpsace handle such exception.

Related to #VSTOR-107235
https://virtuozzo.atlassian.net/browse/VSTOR-107235

Signed-off-by: Liu Kui <kui.liu at virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_krpc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fs/fuse/kio/pcs/pcs_krpc.c b/fs/fuse/kio/pcs/pcs_krpc.c
index 0b47afb9bb01..e8c924c1a5da 100644
--- a/fs/fuse/kio/pcs/pcs_krpc.c
+++ b/fs/fuse/kio/pcs/pcs_krpc.c
@@ -85,10 +85,17 @@ static void krpc_req_complete(struct krpc_req *kreq, int error)
 {
 	struct krpc_completion *comp = &kreq->completion;
 	struct pcs_krpc *krpc = kreq->krpc;
+	struct pcs_rpc_hdr *h = (struct pcs_rpc_hdr *)kreq->hdr_buf;
 
 	BUG_ON(!comp->xid);
 
 	comp->result = error;
+	if (!comp->result && !(RPC_IS_RESPONSE(h->type))) {
+		/*
+		 * This should never happen, catch the event if it happens.
+		 */
+		WARN_ON_ONCE(1);
+	}
 
 	kreq_release_data_chunks(kreq);
 	if (kreq->hdr_chunk.mr)
-- 
2.39.5 (Apple Git-154)



More information about the Devel mailing list