From a619ceabf44a561bcde1d7128b382f41deca602f Mon Sep 17 00:00:00 2001 From: Sebastien Buisson Date: Mon, 2 Nov 2020 23:27:00 +0900 Subject: [PATCH] LU-14095 gss: use hlist_unhashed() instead of ->next In cache_detail list-mutation primitives, verifying the status of an entry must be done using hlist_unhashed(), in case 'struct cache_head' has a 'cache_list' field. Signed-off-by: Sebastien Buisson Change-Id: I1410eca9a647b74127cf40b8f3d6b68d055f773a Reviewed-on: https://review.whamcloud.com/40514 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Andreas Dilger --- lustre/ptlrpc/gss/gss_svc_upcall.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lustre/ptlrpc/gss/gss_svc_upcall.c b/lustre/ptlrpc/gss/gss_svc_upcall.c index 04c0a8c..9cd8023 100644 --- a/lustre/ptlrpc/gss/gss_svc_upcall.c +++ b/lustre/ptlrpc/gss/gss_svc_upcall.c @@ -230,15 +230,15 @@ static inline void __rsi_update(struct rsi *new, struct rsi *item) static void rsi_put(struct kref *ref) { - struct rsi *rsi = container_of(ref, struct rsi, h.ref); + struct rsi *rsi = container_of(ref, struct rsi, h.ref); #ifdef HAVE_CACHE_HEAD_HLIST - LASSERT(rsi->h.cache_list.next == NULL); + LASSERT(hlist_unhashed(&rsi->h.cache_list)); #else LASSERT(rsi->h.next == NULL); #endif - rsi_free(rsi); - OBD_FREE_PTR(rsi); + rsi_free(rsi); + OBD_FREE_PTR(rsi); } static int rsi_match(struct cache_head *a, struct cache_head *b) @@ -473,15 +473,15 @@ static inline void __rsc_update(struct rsc *new, struct rsc *tmp) static void rsc_put(struct kref *ref) { - struct rsc *rsci = container_of(ref, struct rsc, h.ref); + struct rsc *rsci = container_of(ref, struct rsc, h.ref); #ifdef HAVE_CACHE_HEAD_HLIST - LASSERT(rsci->h.cache_list.next == NULL); + LASSERT(hlist_unhashed(&rsci->h.cache_list)); #else - LASSERT(rsci->h.next == NULL); + LASSERT(rsci->h.next == NULL); #endif - rsc_free(rsci); - OBD_FREE_PTR(rsci); + rsc_free(rsci); + OBD_FREE_PTR(rsci); } static int rsc_match(struct cache_head *a, struct cache_head *b) -- 1.8.3.1