aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMichel Lespinasse <walken@google.com>2012-03-26 20:32:44 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-02 12:27:19 -0400
commit19f490da69bacce1d3b9934116bbff0ae5f50530 (patch)
tree4e171896bf0298da5d17dacca9be76a0389dbaea /fs
parent471320c7569290aeed04f9c730d92b67b9acb53d (diff)
vfs: fix d_ancestor() case in d_materialize_unique
commit b18dafc86bb879d2f38a1743985d7ceb283c2f4d upstream. In d_materialise_unique() there are 3 subcases to the 'aliased dentry' case; in two subcases the inode i_lock is properly released but this does not occur in the -ELOOP subcase. This seems to have been introduced by commit 1836750115f2 ("fix loop checks in d_materialise_unique()"). Signed-off-by: Michel Lespinasse <walken@google.com> [ Added a comment, and moved the unlock to where we generate the -ELOOP, which seems to be more natural. You probably can't actually trigger this without a buggy network file server - d_materialize_unique() is for finding aliases on non-local filesystems, and the d_ancestor() case is for a hardlinked directory loop. But we should be robust in the case of such buggy servers anyway. ] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/dcache.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index f598b98c00d..0b51cfc9291 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2433,6 +2433,7 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode)
2433 if (d_ancestor(alias, dentry)) { 2433 if (d_ancestor(alias, dentry)) {
2434 /* Check for loops */ 2434 /* Check for loops */
2435 actual = ERR_PTR(-ELOOP); 2435 actual = ERR_PTR(-ELOOP);
2436 spin_unlock(&inode->i_lock);
2436 } else if (IS_ROOT(alias)) { 2437 } else if (IS_ROOT(alias)) {
2437 /* Is this an anonymous mountpoint that we 2438 /* Is this an anonymous mountpoint that we
2438 * could splice into our tree? */ 2439 * could splice into our tree? */
@@ -2442,7 +2443,7 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode)
2442 goto found; 2443 goto found;
2443 } else { 2444 } else {
2444 /* Nope, but we must(!) avoid directory 2445 /* Nope, but we must(!) avoid directory
2445 * aliasing */ 2446 * aliasing. This drops inode->i_lock */
2446 actual = __d_unalias(inode, dentry, alias); 2447 actual = __d_unalias(inode, dentry, alias);
2447 } 2448 }
2448 write_sequnlock(&rename_lock); 2449 write_sequnlock(&rename_lock);