From 4d93fd79e8b05de1065fc60abce9b0d052a92627 Mon Sep 17 00:00:00 2001 From: Sebastien Buisson Date: Sat, 19 Mar 2022 01:43:31 +0900 Subject: [PATCH] LU-15661 nodemap: fix map mode value for 'both' The patch that introduced the ability to map project IDs with nodemap changed the value used for the "map both uid and gid" case, from 0 to 3. This poses a problem in case of upgrade from a previous Lustre version, so re-introduce the value 0 as NODEMAP_MAP_BOTH_LEGACY. Change-Id: I1f605de9c97faff32411da5052e8782a60645767 Fixes: 8a770616a5 ("LU-14797 sec: add projid to nodemap") Signed-off-by: Sebastien Buisson Reviewed-on: https://review.whamcloud.com/46870 Reviewed-by: Andreas Dilger Tested-by: jenkins Tested-by: Maloo Reviewed-by: Patrick Farrell Reviewed-by: Oleg Drokin --- lustre/include/lustre_nodemap.h | 1 + lustre/ptlrpc/nodemap_storage.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lustre/include/lustre_nodemap.h b/lustre/include/lustre_nodemap.h index 8754a97..80f123a 100644 --- a/lustre/include/lustre_nodemap.h +++ b/lustre/include/lustre_nodemap.h @@ -53,6 +53,7 @@ enum nodemap_tree_type { }; enum nodemap_mapping_modes { + NODEMAP_MAP_BOTH_LEGACY = 0x0, /* for compatibility */ NODEMAP_MAP_UID = 0x01, NODEMAP_MAP_GID = 0x02, NODEMAP_MAP_BOTH = 0x03, /* for compatibility */ diff --git a/lustre/ptlrpc/nodemap_storage.c b/lustre/ptlrpc/nodemap_storage.c index 210d9d3..de60d0f 100644 --- a/lustre/ptlrpc/nodemap_storage.c +++ b/lustre/ptlrpc/nodemap_storage.c @@ -781,6 +781,8 @@ static int nodemap_process_keyrec(struct nodemap_config *config, NODEMAP_MAP_GID : 0) | (flags & NM_FL_MAP_PROJID ? NODEMAP_MAP_PROJID : 0); + if (nodemap->nmf_map_mode == NODEMAP_MAP_BOTH_LEGACY) + nodemap->nmf_map_mode = NODEMAP_MAP_BOTH; nodemap->nmf_enable_audit = flags & NM_FL_ENABLE_AUDIT; nodemap->nmf_forbid_encryption = -- 1.8.3.1