On Sun, 2012-04-15 at 14:05 -0700, Jan Sanislo wrote: > We are seeing occasional (approx. weekly) automount/kernel crashes using > kernel version 3.1.7 and autofs version 5.0.5-39. The log files show > the following traceback: Could you give this patch a try please. autofs4 - fix get_next_positive_subdir() From: Ian Kent <ikent@xxxxxxxxxx> The function get_next_positive_subdir() was not using the correct d_subdirs list locking. Signed-off-by: Ian Kent <ikent@xxxxxxxxxx> --- fs/autofs4/expire.c | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-) diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c index 450f529..bc87da4 100644 --- a/fs/autofs4/expire.c +++ b/fs/autofs4/expire.c @@ -97,9 +97,9 @@ static struct dentry *get_next_positive_subdir(struct dentry *prev, struct dentry *p, *q; spin_lock(&sbi->lookup_lock); + spin_lock(&root->d_lock); if (prev == NULL) { - spin_lock(&root->d_lock); prev = dget_dlock(root); next = prev->d_subdirs.next; p = prev; @@ -107,12 +107,11 @@ static struct dentry *get_next_positive_subdir(struct dentry *prev, } p = prev; - spin_lock(&p->d_lock); -again: +next: next = p->d_u.d_child.next; start: if (next == &root->d_subdirs) { - spin_unlock(&p->d_lock); + spin_unlock(&root->d_lock); spin_unlock(&sbi->lookup_lock); dput(prev); return NULL; @@ -122,14 +121,14 @@ start: spin_lock_nested(&q->d_lock, DENTRY_D_LOCK_NESTED); /* Negative dentry - try next */ - if (!simple_positive(q)) { - spin_unlock(&p->d_lock); + if (q->d_count == 0 || !simple_positive(q)) { + spin_unlock(&q->d_lock); p = q; - goto again; + goto next; } dget_dlock(q); spin_unlock(&q->d_lock); - spin_unlock(&p->d_lock); + spin_unlock(&root->d_lock); spin_unlock(&sbi->lookup_lock); dput(prev); -- To unsubscribe from this list: send the line "unsubscribe autofs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html