]> git.proxmox.com Git - mirror_spl.git/commitdiff
Fix lockdep warning in spl_inode_{lock,unlock}
authorOlaf Faaland <faaland1@llnl.gov>
Wed, 14 Oct 2015 06:08:44 +0000 (23:08 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Sat, 12 Dec 2015 00:19:47 +0000 (16:19 -0800)
spl_inode_{lock,unlock} are triggering possible recursive locking
warnings from lockdep.  The warning is a false positive.

The lock is used to protect a parent directory during delete/add
operations, used in zfs when writing/removing the cache file.  The inode
lock is taken on both the parent inode and the file inode.

VFS provides an enum to subclass the lock.  This patch changes the
spin_lock call to _nested version and uses the provided enum.

Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #480

include/linux/file_compat.h

index a2db2590a23554e7fc56fa841e79c58793275e8e..c58bb815608bf367a56ca9b81b94669b9e28e048 100644 (file)
@@ -76,7 +76,7 @@ spl_filp_fallocate(struct file *fp, int mode, loff_t offset, loff_t len)
 #define        spl_filp_fsync(fp, sync)        vfs_fsync(fp, (fp)->f_dentry, sync)
 #endif /* HAVE_2ARGS_VFS_FSYNC */
 
-#define        spl_inode_lock(ip)              mutex_lock(&(ip)->i_mutex)
+#define        spl_inode_lock(ip)              mutex_lock_nested(&(ip)->i_mutex, I_MUTEX_PARENT)
 #define        spl_inode_unlock(ip)            mutex_unlock(&(ip)->i_mutex)
 
 #endif /* SPL_FILE_COMPAT_H */