Linux: osi_TryEvictVCache: Don’t skip the first dentry if D_ALIAS_IS_HLIST
authorAnders Kaseorg <andersk@mit.edu>
Tue, 7 May 2013 04:27:33 +0000 (00:27 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Sat, 11 May 2013 15:43:32 +0000 (08:43 -0700)
commitad6e31d5fea221bf5eefcd35a416667bc7c1f9be
tree6b78b447affa5c9d7dd2808db5db08fbd0915549
parent13a3ba7ba2d660a08925a3ccd05d74eedcf8c5cd
Linux: osi_TryEvictVCache: Don’t skip the first dentry if D_ALIAS_IS_HLIST

An hlist doesn’t begin with a sentinel like a list does, so the old
code would skip the first dentry or crash with a NULL dereference if
there wasn’t one.  Use the kernel’s list_for_each_entry or
hlist_for_each_entry macros instead of trying to do it manually.

Should fix a crash observed by Alex Chernyakhovsky on kernel 3.6 and
newer.

Change-Id: I6d7bd190013a0250ca896af8d5182df55a3376b0
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-on: http://gerrit.openafs.org/9857
Reviewed-by: Alex Chernyakhovsky <achernya@mit.edu>
Tested-by: Alex Chernyakhovsky <achernya@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
src/afs/LINUX/osi_vcache.c