Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vfs: dcache: use DCACHE_DENTRY_KILLED instead of DCACHE_DISCONNECTED in d_kill()

IBM reported a soft lockup after applying the fix for the rename_lock
deadlock. Commit c83ce989cb5f ("VFS: Fix the nfs sillyrename regression
in kernel 2.6.38") was found to be the culprit.

The nfs sillyrename fix used DCACHE_DISCONNECTED to indicate that the
dentry was killed. This flag can be set on non-killed dentries too,
which results in infinite retries when trying to traverse the dentry
tree.

This patch introduces a separate flag: DCACHE_DENTRY_KILLED, which is
only set in d_kill() and makes try_to_ascend() test only this flag.

IBM reported successful test results with this patch.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Miklos Szeredi and committed by
Linus Torvalds
b161dfa6 4651afbb

+4 -2
+2 -2
fs/dcache.c
··· 389 389 * Inform try_to_ascend() that we are no longer attached to the 390 390 * dentry tree 391 391 */ 392 - dentry->d_flags |= DCACHE_DISCONNECTED; 392 + dentry->d_flags |= DCACHE_DENTRY_KILLED; 393 393 if (parent) 394 394 spin_unlock(&parent->d_lock); 395 395 dentry_iput(dentry); ··· 1048 1048 * or deletion 1049 1049 */ 1050 1050 if (new != old->d_parent || 1051 - (old->d_flags & DCACHE_DISCONNECTED) || 1051 + (old->d_flags & DCACHE_DENTRY_KILLED) || 1052 1052 (!locked && read_seqretry(&rename_lock, seq))) { 1053 1053 spin_unlock(&new->d_lock); 1054 1054 new = NULL;
+2
include/linux/dcache.h
··· 206 206 #define DCACHE_MANAGED_DENTRY \ 207 207 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT) 208 208 209 + #define DCACHE_DENTRY_KILLED 0x100000 210 + 209 211 extern seqlock_t rename_lock; 210 212 211 213 static inline int dname_external(struct dentry *dentry)