]> git.hungrycats.org Git - linux/commitdiff
[PATCH] d_lookup forgotten spin_unlock()
authorAndrew Morton <akpm@digeo.com>
Mon, 24 Mar 2003 01:33:20 +0000 (17:33 -0800)
committerChristoph Hellwig <hch@hera.kernel.org>
Mon, 24 Mar 2003 01:33:20 +0000 (17:33 -0800)
From: Nikita Danilov, Maneesh Soni

d_lookup() is forgetting to release the lock when the rename race happens.

fs/dcache.c

index bc81b85309e094df7019deb1eb05592d642a2d0f..bd561bf0697975a1666f34c0aa088ea353755eab 100644 (file)
@@ -995,12 +995,12 @@ struct dentry * d_lookup(struct dentry * parent, struct qstr * name)
                /*
                 * If dentry is moved, fail the lookup
                 */ 
-               if (unlikely(move_count != dentry->d_move_count)) 
-                       break;
-               if (!d_unhashed(dentry)) {
-                       atomic_inc(&dentry->d_count);
-                       dentry->d_vfs_flags |= DCACHE_REFERENCED;
-                       found = dentry;
+               if (likely(move_count == dentry->d_move_count)) {
+                       if (!d_unhashed(dentry)) {
+                               atomic_inc(&dentry->d_count);
+                               dentry->d_vfs_flags |= DCACHE_REFERENCED;
+                               found = dentry;
+                       }
                }
                spin_unlock(&dentry->d_lock);
                break;