From f082aecb88e37b319051752607cc856cc9320b7d Mon Sep 17 00:00:00 2001 From: Ian Kent Date: Mon, 6 Aug 2012 09:37:47 +0800 Subject: [PATCH] --- yaml --- r: 321687 b: refs/heads/master c: a45440f05e9ebc26f2a375df911823fdef5b5281 h: refs/heads/master i: 321685: 9378f9c304d2d602a70b4825ab443da695e7fc46 321683: 7b13878e4e2b80b108ab49a86d3d11c8bdcbcd16 321679: d797f118f9f6fa6842fa13f6a87f30885e5835ad v: v3 --- [refs] | 2 +- trunk/fs/autofs4/expire.c | 31 +++++++++++++------------------ 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/[refs] b/[refs] index fed9aff964b0..cd2330e1377e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 63ca5f1d17a4eecaec3149982223fe89e55a568f +refs/heads/master: a45440f05e9ebc26f2a375df911823fdef5b5281 diff --git a/trunk/fs/autofs4/expire.c b/trunk/fs/autofs4/expire.c index 1feb68ecef95..8c0e56d92938 100644 --- a/trunk/fs/autofs4/expire.c +++ b/trunk/fs/autofs4/expire.c @@ -94,25 +94,21 @@ static struct dentry *get_next_positive_subdir(struct dentry *prev, { struct autofs_sb_info *sbi = autofs4_sbi(root->d_sb); struct list_head *next; - struct dentry *p, *q; + struct dentry *q; spin_lock(&sbi->lookup_lock); + spin_lock(&root->d_lock); - if (prev == NULL) { - spin_lock(&root->d_lock); + if (prev) + next = prev->d_u.d_child.next; + else { prev = dget_dlock(root); next = prev->d_subdirs.next; - p = prev; - goto start; } - p = prev; - spin_lock(&p->d_lock); -again: - next = p->d_u.d_child.next; -start: +cont: if (next == &root->d_subdirs) { - spin_unlock(&p->d_lock); + spin_unlock(&root->d_lock); spin_unlock(&sbi->lookup_lock); dput(prev); return NULL; @@ -121,16 +117,15 @@ static struct dentry *get_next_positive_subdir(struct dentry *prev, q = list_entry(next, struct dentry, d_u.d_child); spin_lock_nested(&q->d_lock, DENTRY_D_LOCK_NESTED); - /* Negative dentry - try next */ - if (!simple_positive(q)) { - spin_unlock(&p->d_lock); - lock_set_subclass(&q->d_lock.dep_map, 0, _RET_IP_); - p = q; - goto again; + /* Already gone or negative dentry (under construction) - try next */ + if (q->d_count == 0 || !simple_positive(q)) { + spin_unlock(&q->d_lock); + next = q->d_u.d_child.next; + goto cont; } 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);