Whamcloud - gitweb
Revert "b=15692 statahead should hold parent dir's i_mutex..."
[fs/lustre-release.git] / lustre / llite / namei.c
index f3e2dac..efc469b 100644 (file)
@@ -154,6 +154,7 @@ static void ll_drop_negative_dentry(struct inode *dir)
 {
         struct dentry *dentry, *tmp_alias, *tmp_subdir;
 
+        cfs_spin_lock(&ll_lookup_lock);
         spin_lock(&dcache_lock);
 restart:
         list_for_each_entry_safe(dentry, tmp_alias,
@@ -174,6 +175,7 @@ restart:
                 }
         }
         spin_unlock(&dcache_lock);
+        cfs_spin_unlock(&ll_lookup_lock);
 }
 
 
@@ -348,6 +350,7 @@ static struct dentry *ll_find_alias(struct inode *inode, struct dentry *de)
         struct dentry *dentry;
         struct dentry *last_discon = NULL;
 
+        cfs_spin_lock(&ll_lookup_lock);
         spin_lock(&dcache_lock);
         list_for_each(tmp, &inode->i_dentry) {
                 dentry = list_entry(tmp, struct dentry, d_alias);
@@ -384,6 +387,7 @@ static struct dentry *ll_find_alias(struct inode *inode, struct dentry *de)
                 ll_dops_init(dentry, 0);
                 d_rehash_cond(dentry, 0); /* avoid taking dcache_lock inside */
                 spin_unlock(&dcache_lock);
+                cfs_spin_unlock(&ll_lookup_lock);
                 iput(inode);
                 CDEBUG(D_DENTRY, "alias dentry %.*s (%p) parent %p inode %p "
                        "refc %d\n", de->d_name.len, de->d_name.name, de,
@@ -400,6 +404,7 @@ static struct dentry *ll_find_alias(struct inode *inode, struct dentry *de)
                 last_discon->d_flags |= DCACHE_LUSTRE_INVALID;
                 unlock_dentry(last_discon);
                 spin_unlock(&dcache_lock);
+                cfs_spin_unlock(&ll_lookup_lock);
                 ll_dops_init(last_discon, 1);
                 d_rehash(de);
                 d_move(last_discon, de);
@@ -410,6 +415,7 @@ static struct dentry *ll_find_alias(struct inode *inode, struct dentry *de)
         ll_d_add(de, inode);
 
         spin_unlock(&dcache_lock);
+        cfs_spin_unlock(&ll_lookup_lock);
 
         return de;
 }
@@ -465,7 +471,7 @@ int ll_lookup_it_finish(struct ptlrpc_request *request,
                 /* we have lookup look - unhide dentry */
                 if (bits & MDS_INODELOCK_LOOKUP) {
                         lock_dentry(*de);
-                        (*de)->d_flags &= ~DCACHE_LUSTRE_INVALID;
+                        (*de)->d_flags &= ~(DCACHE_LUSTRE_INVALID);
                         unlock_dentry(*de);
                 }
         } else {
@@ -577,7 +583,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
             !S_ISDIR(dentry->d_inode->i_mode)) {
                 ll_release_openhandle(dentry, it);
         }
-        ll_finish_locks(it, dentry);
+        ll_lookup_finish_locks(it, dentry);
 
         if (dentry == save)
                 GOTO(out, retval = NULL);