aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dcache.c
diff options
context:
space:
mode:
authorMichel Lespinasse <walken@google.com>2012-03-26 20:32:44 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-28 12:54:34 -0400
commitb18dafc86bb879d2f38a1743985d7ceb283c2f4d (patch)
tree447070f77406615aebadaef03018d634c0da922c /fs/dcache.c
parent6658a6991cef75719a21441aa0b7f8d6821534ee (diff)
vfs: fix d_ancestor() case in d_materialize_unique
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> Cc: stable@vger.kernel.org # v3.0+ [ 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>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r--fs/dcache.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index e9a07b2a0948..b60ddc41d783 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2404,6 +2404,7 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode)
2404 if (d_ancestor(alias, dentry)) { 2404 if (d_ancestor(alias, dentry)) {
2405 /* Check for loops */ 2405 /* Check for loops */
2406 actual = ERR_PTR(-ELOOP); 2406 actual = ERR_PTR(-ELOOP);
2407 spin_unlock(&inode->i_lock);
2407 } else if (IS_ROOT(alias)) { 2408 } else if (IS_ROOT(alias)) {
2408 /* Is this an anonymous mountpoint that we 2409 /* Is this an anonymous mountpoint that we
2409 * could splice into our tree? */ 2410 * could splice into our tree? */
@@ -2413,7 +2414,7 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode)
2413 goto found; 2414 goto found;
2414 } else { 2415 } else {
2415 /* Nope, but we must(!) avoid directory 2416 /* Nope, but we must(!) avoid directory
2416 * aliasing */ 2417 * aliasing. This drops inode->i_lock */
2417 actual = __d_unalias(inode, dentry, alias); 2418 actual = __d_unalias(inode, dentry, alias);
2418 } 2419 }
2419 write_sequnlock(&rename_lock); 2420 write_sequnlock(&rename_lock);