From 8683b953347fc16a7fa55a838d30b0754df95cfa Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Fri, 27 May 2022 10:14:05 +1000 Subject: [PATCH] LU-10391 mdt: change md_perm.mp_nid to large nid mp_nid in struct md_perm is now a large nid. Signed-off-by: Mr NeilBrown Change-Id: Id7502a5399191a36550162837cce37d3bfc9797e Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50103 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Sebastien Buisson Reviewed-by: Nathaniel Clark Reviewed-by: Oleg Drokin --- lustre/include/upcall_cache.h | 2 +- lustre/mdt/mdt_identity.c | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lustre/include/upcall_cache.h b/lustre/include/upcall_cache.h index 6ac4a40..572e616 100644 --- a/lustre/include/upcall_cache.h +++ b/lustre/include/upcall_cache.h @@ -65,7 +65,7 @@ struct upcall_cache_entry; struct md_perm { - lnet_nid_t mp_nid; + struct lnet_nid mp_nid; uint32_t mp_perm; }; diff --git a/lustre/mdt/mdt_identity.c b/lustre/mdt/mdt_identity.c index d8de61a..508231e 100644 --- a/lustre/mdt/mdt_identity.c +++ b/lustre/mdt/mdt_identity.c @@ -167,7 +167,8 @@ static int mdt_identity_parse_downcall(struct upcall_cache *cache, } for (i = 0; i < data->idd_nperms; i++) { - perms[i].mp_nid = data->idd_perms[i].pdd_nid; + lnet_nid4_to_nid(data->idd_perms[i].pdd_nid, + &perms[i].mp_nid); perms[i].mp_perm = data->idd_perms[i].pdd_perm; } } @@ -233,26 +234,23 @@ void mdt_flush_identity(struct upcall_cache *cache, int uid) __u32 mdt_identity_get_perm(struct md_identity *identity, struct lnet_nid *nid) { struct md_perm *perm; - lnet_nid_t nid4; int i; if (!identity) return CFS_SETGRP_PERM; - if (!nid_is_nid4(nid)) - return CFS_SETGRP_PERM; - nid4 = lnet_nid_to_nid4(nid); perm = identity->mi_perms; /* check exactly matched nid first */ for (i = identity->mi_nperms - 1; i > 0; i--) { - if (perm[i].mp_nid != nid4) + if (!nid_same(&perm[i].mp_nid, nid)) continue; return perm[i].mp_perm; } /* check LNET_NID_ANY then */ if ((identity->mi_nperms > 0) && - ((perm[0].mp_nid == nid4) || (perm[0].mp_nid == LNET_NID_ANY))) + ((nid_same(&perm[0].mp_nid, nid)) || + (LNET_NID_IS_ANY(&perm[0].mp_nid)))) return perm[0].mp_perm; /* return default last */ -- 1.8.3.1