Whamcloud - gitweb
LU-14095 gss: use hlist_unhashed() instead of ->next 14/40514/4
authorSebastien Buisson <sbuisson@ddn.com>
Mon, 2 Nov 2020 14:27:00 +0000 (23:27 +0900)
committerOleg Drokin <green@whamcloud.com>
Thu, 3 Dec 2020 07:26:39 +0000 (07:26 +0000)
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 <sbuisson@ddn.com>
Change-Id: I1410eca9a647b74127cf40b8f3d6b68d055f773a
Reviewed-on: https://review.whamcloud.com/40514
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/ptlrpc/gss/gss_svc_upcall.c

index 04c0a8c..9cd8023 100644 (file)
@@ -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)