[Devel] [PATCH VZ9 v2] fs/fuse kio: skip looking into response to request from userspace
Liu Kui
kui.liu at virtuozzo.com
Mon Jul 29 08:43:04 MSK 2024
Response to userspace requests should not be analyzed and translated
to msg->errors. Instead the entire response message should be just
passed to userspace and let userspace handle it.
Fix the issue that userspace krpcio getting aborted by PCS_RPC_ERROR_RESP
response.
Signed-off-by: Liu Kui <kui.liu at virtuozzo.com>
---
fs/fuse/kio/pcs/pcs_krpc.c | 5 -----
fs/fuse/kio/pcs/pcs_rpc.c | 7 +++++++
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/fs/fuse/kio/pcs/pcs_krpc.c b/fs/fuse/kio/pcs/pcs_krpc.c
index 567d8a0c884f..c34f047c7d05 100644
--- a/fs/fuse/kio/pcs/pcs_krpc.c
+++ b/fs/fuse/kio/pcs/pcs_krpc.c
@@ -138,7 +138,6 @@ static void krpc_msg_get_response_iter(struct pcs_msg *msg, int offset,
struct pcs_msg *krpc_get_hdr(struct pcs_rpc *ep, struct pcs_rpc_hdr *h)
{
struct pcs_msg *msg, *resp;
- struct pcs_rpc_hdr *req_h;
struct krpc_req *kreq;
if (!RPC_IS_RESPONSE(h->type))
@@ -148,10 +147,6 @@ struct pcs_msg *krpc_get_hdr(struct pcs_rpc *ep, struct pcs_rpc_hdr *h)
if (msg == NULL)
return NULL;
- req_h = (struct pcs_rpc_hdr *)msg_inline_head(msg);
- if (req_h->type != (h->type & ~PCS_RPC_DIRECTION))
- return NULL;
-
kreq = msg->private2;
resp = pcs_rpc_alloc_input_msg(ep, sizeof(struct pcs_rpc_hdr));
diff --git a/fs/fuse/kio/pcs/pcs_rpc.c b/fs/fuse/kio/pcs/pcs_rpc.c
index deebc1dddf1b..f990f0f30609 100644
--- a/fs/fuse/kio/pcs/pcs_rpc.c
+++ b/fs/fuse/kio/pcs/pcs_rpc.c
@@ -484,6 +484,12 @@ static void handle_response(struct pcs_rpc * ep, struct pcs_msg * msg)
pcs_msg_del_calendar(req);
list_del(&req->list);
+ /* don't try to interpret response to request from userspace */
+ if (!(h->xid.origin.val & PCS_NODE_ALT_MASK)) {
+ req->response = msg;
+ goto skip;
+ }
+
if (h->type == PCS_RPC_ERROR_RESP) {
struct pcs_rpc_error_resp * eh = (struct pcs_rpc_error_resp *)msg->_inline_buffer;
@@ -502,6 +508,7 @@ static void handle_response(struct pcs_rpc * ep, struct pcs_msg * msg)
req->response = msg;
}
+skip:
if (ep->ops->hook_response)
ep->ops->hook_response(ep, req);
--
2.39.3 (Apple Git-146)
More information about the Devel
mailing list