From: Marc Dionne Date: Fri, 12 Oct 2012 20:25:43 +0000 (-0400) Subject: Linux: osi_vcache: Fix loop for the hlist case X-Git-Tag: upstream/1.6.2_pre2^2~99 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=0506af9c058e22e3475f7e152c022571c0823253;p=packages%2Fo%2Fopenafs.git Linux: osi_vcache: Fix loop for the hlist case An hlist is not circular, and the end is marked by a NULL next pointer. Reviewed-on: http://gerrit.openafs.org/8233 Tested-by: BuildBot Reviewed-by: Derrick Brashear (cherry picked from commit 78ae01fb9837d79e7bbdb2918872ab106d4c7e98) Change-Id: I7e4e3ed2515dd8c2ec765d8acbb97eba189d6aeb Reviewed-on: http://gerrit.openafs.org/8239 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- 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