From afe5813a482478642acc0aacfe195d465e0f1e2c Mon Sep 17 00:00:00 2001 From: Etienne AUJAMES Date: Wed, 24 May 2023 15:26:27 +0200 Subject: [PATCH] LU-16077 ptlrpc: Fix ptlrpc_body_v2 with pb_uid/pb_gid ptlrpc_body_v2 and ptlrpc_body_v3 should have the same fields except for jobid. This patch fixes the debug request messages by printing request uid/gid at the end. That way debugging tools can still parse message for newer versions. Fixes: 0544c10 ("LU-16077 tbf: pb_uid/pb_gid ptlrpc_body fields for TBF rules") Test-Parameters: testlist=sanityn env=ONLY=77,ONLY_REPEAT=20 Signed-off-by: Etienne AUJAMES Change-Id: I1faa13fa7c5b03bfeeb7cd75f7dbbfa8ca8ca941 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51122 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Patrick Farrell Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger --- lustre/include/uapi/linux/lustre/lustre_idl.h | 3 ++- lustre/ptlrpc/pack_generic.c | 4 ++-- lustre/ptlrpc/wiretest.c | 14 ++++++++------ lustre/utils/wirecheck.c | 7 ++----- lustre/utils/wiretest.c | 14 ++++++++------ 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/lustre/include/uapi/linux/lustre/lustre_idl.h b/lustre/include/uapi/linux/lustre/lustre_idl.h index 6a61cae..400a99d 100644 --- a/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -720,7 +720,8 @@ struct ptlrpc_body_v2 { /* padding for future needs */ __u64 pb_padding64_0; __u64 pb_padding64_1; - __u64 pb_padding64_2; + __u32 pb_uid; /* req: process uid, use by tbf rules */ + __u32 pb_gid; /* req: process gid, use by tbf rules */ }; /* message body offset for lustre_msg_v2 */ diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index 889109a..61e4b18 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -2890,7 +2890,7 @@ void _debug_req(struct ptlrpc_request *req, vaf.fmt = fmt; vaf.va = &args; libcfs_debug_msg(msgdata, - "%pV req@%p x%llu/t%lld(%llu) o%d->%s@%s:%d/%d lens %d/%d e %d to %lld dl %lld ref %d fl " REQ_FLAGS_FMT "/%x/%x rc %d/%d uid:%u gid:%u job:'%s'\n", + "%pV req@%p x%llu/t%lld(%llu) o%d->%s@%s:%d/%d lens %d/%d e %d to %lld dl %lld ref %d fl " REQ_FLAGS_FMT "/%x/%x rc %d/%d job:'%s' uid:%u gid:%u\n", &vaf, req, req->rq_xid, req->rq_transno, req_transno, req_opc, @@ -2907,7 +2907,7 @@ void _debug_req(struct ptlrpc_request *req, atomic_read(&req->rq_refcount), DEBUG_REQ_FLAGS(req), req_flags, rep_flags, req->rq_status, rep_status, - req_uid, req_gid, req_jobid ?: ""); + req_jobid ?: "", req_uid, req_gid); va_end(args); } EXPORT_SYMBOL(_debug_req); diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index efdbbc2..172903f 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -1064,12 +1064,14 @@ void lustre_assert_wire_constants(void) (int)offsetof(struct ptlrpc_body_v3, pb_padding64_1), (int)offsetof(struct ptlrpc_body_v2, pb_padding64_1)); LASSERTF((int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_padding64_1) == (int)sizeof(((struct ptlrpc_body_v2 *)0)->pb_padding64_1), "%d != %d\n", (int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_padding64_1), (int)sizeof(((struct ptlrpc_body_v2 *)0)->pb_padding64_1)); - LASSERTF((int)offsetof(struct ptlrpc_body_v3, pb_uid) == (int)offsetof(struct ptlrpc_body_v2, pb_padding64_2), "%d != %d\n", - (int)offsetof(struct ptlrpc_body_v3, pb_uid), (int)offsetof(struct ptlrpc_body_v2, pb_padding64_2)); - LASSERTF((int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_uid) + (int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_gid) == - (int)sizeof(((struct ptlrpc_body_v2 *)0)->pb_padding64_2), "%d != %d\n", - (int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_uid) + (int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_gid), - (int)sizeof(((struct ptlrpc_body_v2 *)0)->pb_padding64_2)); + LASSERTF((int)offsetof(struct ptlrpc_body_v3, pb_uid) == (int)offsetof(struct ptlrpc_body_v2, pb_uid), "%d != %d\n", + (int)offsetof(struct ptlrpc_body_v3, pb_uid), (int)offsetof(struct ptlrpc_body_v2, pb_uid)); + LASSERTF((int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_uid) == (int)sizeof(((struct ptlrpc_body_v2 *)0)->pb_uid), "%d != %d\n", + (int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_uid), (int)sizeof(((struct ptlrpc_body_v2 *)0)->pb_uid)); + LASSERTF((int)offsetof(struct ptlrpc_body_v3, pb_gid) == (int)offsetof(struct ptlrpc_body_v2, pb_gid), "%d != %d\n", + (int)offsetof(struct ptlrpc_body_v3, pb_gid), (int)offsetof(struct ptlrpc_body_v2, pb_gid)); + LASSERTF((int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_gid) == (int)sizeof(((struct ptlrpc_body_v2 *)0)->pb_gid), "%d != %d\n", + (int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_gid), (int)sizeof(((struct ptlrpc_body_v2 *)0)->pb_gid)); LASSERTF(MSG_PTLRPC_BODY_OFF == 0, "found %lld\n", (long long)MSG_PTLRPC_BODY_OFF); LASSERTF(REQ_REC_OFF == 1, "found %lld\n", diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index 077b145..614e768 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -500,11 +500,8 @@ check_ptlrpc_body(void) CHECK_MEMBER_SAME(ptlrpc_body_v3, ptlrpc_body_v2, pb_mbits); CHECK_MEMBER_SAME(ptlrpc_body_v3, ptlrpc_body_v2, pb_padding64_0); CHECK_MEMBER_SAME(ptlrpc_body_v3, ptlrpc_body_v2, pb_padding64_1); - CHECK_VALUE_SAME((int)offsetof(struct ptlrpc_body_v3, pb_uid), - (int)offsetof(struct ptlrpc_body_v2, pb_padding64_2)); - CHECK_VALUE_SAME((int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_uid + - (int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_gid), - (int)sizeof(((struct ptlrpc_body_v2 *)0)->pb_padding64_2)); + CHECK_MEMBER_SAME(ptlrpc_body_v3, ptlrpc_body_v2, pb_uid); + CHECK_MEMBER_SAME(ptlrpc_body_v3, ptlrpc_body_v2, pb_gid); CHECK_VALUE(MSG_PTLRPC_BODY_OFF); CHECK_VALUE(REQ_REC_OFF); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index 85d9bfe..b475413 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -1089,12 +1089,14 @@ void lustre_assert_wire_constants(void) (int)offsetof(struct ptlrpc_body_v3, pb_padding64_1), (int)offsetof(struct ptlrpc_body_v2, pb_padding64_1)); LASSERTF((int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_padding64_1) == (int)sizeof(((struct ptlrpc_body_v2 *)0)->pb_padding64_1), "%d != %d\n", (int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_padding64_1), (int)sizeof(((struct ptlrpc_body_v2 *)0)->pb_padding64_1)); - LASSERTF((int)offsetof(struct ptlrpc_body_v3, pb_uid) == (int)offsetof(struct ptlrpc_body_v2, pb_padding64_2), "%d != %d\n", - (int)offsetof(struct ptlrpc_body_v3, pb_uid), (int)offsetof(struct ptlrpc_body_v2, pb_padding64_2)); - LASSERTF((int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_uid) + (int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_gid) == - (int)sizeof(((struct ptlrpc_body_v2 *)0)->pb_padding64_2), "%d != %d\n", - (int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_uid) + (int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_gid), - (int)sizeof(((struct ptlrpc_body_v2 *)0)->pb_padding64_2)); + LASSERTF((int)offsetof(struct ptlrpc_body_v3, pb_uid) == (int)offsetof(struct ptlrpc_body_v2, pb_uid), "%d != %d\n", + (int)offsetof(struct ptlrpc_body_v3, pb_uid), (int)offsetof(struct ptlrpc_body_v2, pb_uid)); + LASSERTF((int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_uid) == (int)sizeof(((struct ptlrpc_body_v2 *)0)->pb_uid), "%d != %d\n", + (int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_uid), (int)sizeof(((struct ptlrpc_body_v2 *)0)->pb_uid)); + LASSERTF((int)offsetof(struct ptlrpc_body_v3, pb_gid) == (int)offsetof(struct ptlrpc_body_v2, pb_gid), "%d != %d\n", + (int)offsetof(struct ptlrpc_body_v3, pb_gid), (int)offsetof(struct ptlrpc_body_v2, pb_gid)); + LASSERTF((int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_gid) == (int)sizeof(((struct ptlrpc_body_v2 *)0)->pb_gid), "%d != %d\n", + (int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_gid), (int)sizeof(((struct ptlrpc_body_v2 *)0)->pb_gid)); LASSERTF(MSG_PTLRPC_BODY_OFF == 0, "found %lld\n", (long long)MSG_PTLRPC_BODY_OFF); LASSERTF(REQ_REC_OFF == 1, "found %lld\n", -- 1.8.3.1