]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - fs/ceph/inode.c
fs: dcache scale subdirs
[mirror_ubuntu-bionic-kernel.git] / fs / ceph / inode.c
index bb68c799074d86775844b57ae7f4858f3b58bc85..2c694447336686daef9ca33a4173891a615fd84b 100644 (file)
@@ -842,11 +842,13 @@ static void ceph_set_dentry_offset(struct dentry *dn)
        spin_unlock(&inode->i_lock);
 
        spin_lock(&dcache_lock);
-       spin_lock(&dn->d_lock);
+       spin_lock(&dir->d_lock);
+       spin_lock_nested(&dn->d_lock, DENTRY_D_LOCK_NESTED);
        list_move(&dn->d_u.d_child, &dir->d_subdirs);
        dout("set_dentry_offset %p %lld (%p %p)\n", dn, di->offset,
             dn->d_u.d_child.prev, dn->d_u.d_child.next);
        spin_unlock(&dn->d_lock);
+       spin_unlock(&dir->d_lock);
        spin_unlock(&dcache_lock);
 }
 
@@ -1232,9 +1234,11 @@ retry_lookup:
                } else {
                        /* reorder parent's d_subdirs */
                        spin_lock(&dcache_lock);
-                       spin_lock(&dn->d_lock);
+                       spin_lock(&parent->d_lock);
+                       spin_lock_nested(&dn->d_lock, DENTRY_D_LOCK_NESTED);
                        list_move(&dn->d_u.d_child, &parent->d_subdirs);
                        spin_unlock(&dn->d_lock);
+                       spin_unlock(&parent->d_lock);
                        spin_unlock(&dcache_lock);
                }