]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - fs/inode.c
lockdep: fixup the inode dir annotation
[mirror_ubuntu-bionic-kernel.git] / fs / inode.c
index f97de0aeb3b69dcd320668ccbf6bbeb6e9d57932..21dab18b2f18641ba24cd119f99be6391fb615bb 100644 (file)
@@ -568,16 +568,16 @@ EXPORT_SYMBOL(new_inode);
 void unlock_new_inode(struct inode *inode)
 {
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
-       struct file_system_type *type = inode->i_sb->s_type;
-       /*
-        * ensure nobody is actually holding i_mutex
-        */
-       mutex_destroy(&inode->i_mutex);
-       mutex_init(&inode->i_mutex);
-       if (inode->i_mode & S_IFDIR)
+       if (inode->i_mode & S_IFDIR) {
+               struct file_system_type *type = inode->i_sb->s_type;
+
+               /*
+                * ensure nobody is actually holding i_mutex
+                */
+               mutex_destroy(&inode->i_mutex);
+               mutex_init(&inode->i_mutex);
                lockdep_set_class(&inode->i_mutex, &type->i_mutex_dir_key);
-       else
-               lockdep_set_class(&inode->i_mutex, &type->i_mutex_key);
+       }
 #endif
        /*
         * This is special!  We do not need the spinlock