From 78ae01fb9837d79e7bbdb2918872ab106d4c7e98 Mon Sep 17 00:00:00 2001 From: Marc Dionne Date: Fri, 12 Oct 2012 16:25:43 -0400 Subject: [PATCH] Linux: osi_vcache: Fix loop for the hlist case An hlist is not circular, and the end is marked by a NULL next pointer. Change-Id: Iec7ad7e3e7ee989d548233b045aa8def1ebfb1dc Reviewed-on: http://gerrit.openafs.org/8233 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/afs/LINUX/osi_vcache.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/afs/LINUX/osi_vcache.c b/src/afs/LINUX/osi_vcache.c index cd61c6565..dc3685b63 100644 --- a/src/afs/LINUX/osi_vcache.c +++ b/src/afs/LINUX/osi_vcache.c @@ -20,9 +20,9 @@ osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) { struct dentry *dentry; struct inode *inode = AFSTOV(avc); #if defined(D_ALIAS_IS_HLIST) - struct hlist_node *cur, *head; + struct hlist_node *cur, *head, *list_end; #else - struct list_head *cur, *head; + struct list_head *cur, *head, *list_end; #endif /* First, see if we can evict the inode from the dcache */ @@ -59,13 +59,15 @@ restart: spin_lock(&inode->i_lock); #if defined(D_ALIAS_IS_HLIST) head = inode->i_dentry.first; + list_end = NULL; #else head = &inode->i_dentry; + list_end = head; #endif restart: cur = head; - while ((cur = cur->next) != head) { + while ((cur = cur->next) != list_end) { #if defined(D_ALIAS_IS_HLIST) dentry = hlist_entry(cur, struct dentry, d_alias); #else -- 2.39.5