Skip to content

Commit

Permalink
Fix lockdep warning in spl_inode_{lock,unlock}
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Issue openzfs#480
  • Loading branch information
ofaaland authored and behlendorf committed Dec 12, 2015
1 parent 692ae8d commit 628fc52
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/linux/file_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 628fc52

Please sign in to comment.