diff options
author | Ian Kent <raven@themaw.net> | 2011-01-17 23:06:04 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-01-18 01:21:26 -0500 |
commit | c14cc63a63e94d490ac6517a555113c30d420db4 (patch) | |
tree | 4769517c39eedbbeaedc7a73636d7c65c0de5a38 /fs | |
parent | 6845a44a314c0c626549de373131bf108f9cc1f1 (diff) |
autofs4 - fix get_next_positive_dentry()
The initialization condition in fs/autofs4/expire.c:get_next_positive_dentry()
appears to be incorrect. If prev == NULL I believe that root should be
returned.
Further down, at the current dentry check for it being simple_positive()
it looks like the d_lock for dentry p should be dropped instead of dentry
ret, otherwise when p is assinged to ret we end up with no lock on p and
a lost lock on ret, which leads to a deadlock.
Signed-off-by: Ian Kent <raven@themaw.net>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/autofs4/expire.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c index 3ed79d76c233..f43100b9662b 100644 --- a/fs/autofs4/expire.c +++ b/fs/autofs4/expire.c | |||
@@ -96,7 +96,7 @@ static struct dentry *get_next_positive_dentry(struct dentry *prev, | |||
96 | struct dentry *p, *ret; | 96 | struct dentry *p, *ret; |
97 | 97 | ||
98 | if (prev == NULL) | 98 | if (prev == NULL) |
99 | return dget(prev); | 99 | return dget(root); |
100 | 100 | ||
101 | spin_lock(&autofs4_lock); | 101 | spin_lock(&autofs4_lock); |
102 | relock: | 102 | relock: |
@@ -133,7 +133,7 @@ again: | |||
133 | spin_lock_nested(&ret->d_lock, DENTRY_D_LOCK_NESTED); | 133 | spin_lock_nested(&ret->d_lock, DENTRY_D_LOCK_NESTED); |
134 | /* Negative dentry - try next */ | 134 | /* Negative dentry - try next */ |
135 | if (!simple_positive(ret)) { | 135 | if (!simple_positive(ret)) { |
136 | spin_unlock(&ret->d_lock); | 136 | spin_unlock(&p->d_lock); |
137 | p = ret; | 137 | p = ret; |
138 | goto again; | 138 | goto again; |
139 | } | 139 | } |