From 2c62cef8ae4107602664271627cf03ff859f7b21 Mon Sep 17 00:00:00 2001 From: Sebastien Buisson Date: Wed, 20 May 2020 18:17:57 +0900 Subject: [PATCH] LU-13593 ptlrpc: fix growing message buffer In case some buffers need to be moved because of segment growth from req_capsule_server_grow(), just set buflen to old length before actually calling lustre_grow_msg(). Signed-off-by: Sebastien Buisson Change-Id: I6707927a0f24c0637dbc79aa91788122a84ab8c4 Reviewed-on: https://review.whamcloud.com/38701 Reviewed-by: Mike Pershin Reviewed-by: Andreas Dilger Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/ptlrpc/layout.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lustre/ptlrpc/layout.c b/lustre/ptlrpc/layout.c index 40bd630..e0929ab 100644 --- a/lustre/ptlrpc/layout.c +++ b/lustre/ptlrpc/layout.c @@ -2626,8 +2626,9 @@ int req_capsule_server_grow(struct req_capsule *pill, /* Now we need only buffers, copy them and grow the needed one */ to = lustre_msg_buf(nrs->rs_msg, 0, 0); from = lustre_msg_buf(rs->rs_msg, 0, 0); - len = (char *)rs->rs_msg + lustre_packed_msg_size(rs->rs_msg) - from; - memcpy(to, from, len); + memcpy(to, from, + (char *)rs->rs_msg + lustre_packed_msg_size(rs->rs_msg) - from); + lustre_msg_set_buflen(nrs->rs_msg, offset, len); pill->rc_req->rq_replen = lustre_grow_msg(nrs->rs_msg, offset, newlen); if (rs->rs_difficult) { -- 1.8.3.1