Linux: osi_TryEvictVCache: Don’t skip the first dentry if D_ALIAS_IS_HLIST
commita71cc5511c115c1b6cb4a6a2997a846bab6e19e2
authorAnders Kaseorg <andersk@mit.edu>
Tue, 7 May 2013 04:27:33 +0000 (7 00:27 -0400)
committerStephan Wiesand <stephan.wiesand@desy.de>
Wed, 15 May 2013 17:31:04 +0000 (15 10:31 -0700)
tree93adf064e6c73ba39eaef3a67ad7facf09a05590
parent3afe8cd715859ec4e758e6b43c82851893dc706e
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.

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>
(cherry picked from commit ad6e31d5fea221bf5eefcd35a416667bc7c1f9be)

Change-Id: Id8b31246067b5a718af91c8c206d5abd5210c558
Reviewed-on: http://gerrit.openafs.org/9898
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/afs/LINUX/osi_vcache.c