Whamcloud - gitweb
LU-16907 ptlrpc: correct the reply buffer size for batch RPC 45/56645/4
authorQian Yingjin <qian@ddn.com>
Thu, 10 Oct 2024 09:48:19 +0000 (17:48 +0800)
committerOleg Drokin <green@whamcloud.com>
Mon, 2 Dec 2024 05:52:08 +0000 (05:52 +0000)
The calculation for growing reply buffer size for a batch RPC is
incorrect and it adds the SUB request size wrongly.
This may result in the following panic:
"Max IOV exceeded: 257 should be < 256"
Fix it accordingly.

Fixes: 5a2dfd36f9c ("LU-14139 ptlrpc: grow PtlRPC properly when prepare sub request")
Test-Parameters: testlist=sanity env=ONLY=123f,ONLY_REPEAT=10
Signed-off-by: Qian Yingjin <qian@ddn.com>
Change-Id: I3c5151a485cac7f3fb9384cd9fb022143ca3389d
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56645
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/ptlrpc/layout.c

index 8b4d1f6..57678d3 100644 (file)
@@ -2063,6 +2063,7 @@ int req_capsule_server_pack(struct req_capsule *pill)
                if (used_len + msg_len > req->rq_replen) {
                        __u32 len;
                        __u32 max;
+                       __u32 add;
 
                        if (!req_capsule_has_field(&req->rq_pill,
                                                   &RMF_BUT_REPLY, RCL_SERVER))
@@ -2079,17 +2080,20 @@ int req_capsule_server_pack(struct req_capsule *pill)
                        len = req_capsule_get_size(&req->rq_pill,
                                                   &RMF_BUT_REPLY, RCL_SERVER);
                        /*
-                        * Currently just increase the batch reply buffer
-                        * by 2.
+                        * Currently just increase the batch RPC reply buffer
+                        * (including @RMF_PTLRPC_BODY + @RMF_BUT_REPLY) by 2.
+                        * We must set the new length carefully as it will be
+                        * rounded up with 8.
                         */
                        max = BUT_MAXREPSIZE - req->rq_replen;
+                       add = len;
                        if (used_len + msg_len > len)
-                               len = used_len + msg_len;
+                               add = used_len + msg_len;
 
-                       if (len > max)
+                       if (add > max)
                                len += max;
                        else
-                               len += len;
+                               len += add;
 
                        rc = req_capsule_server_grow(&req->rq_pill,
                                                     &RMF_BUT_REPLY, len);