Linux 4.7 compat: inode_lock() and friends

Linux 4.7 changes i_mutex to i_rwsem, and we should used inode_lock and
inode_lock_shared to do exclusive and shared lock respectively.

We use spl_inode_lock{,_shared}() to hide the difference. Note that on older
kernel you'll always take an exclusive lock.

We also add all other inode_lock friends. And nested users now should
explicitly call spl_inode_lock_nested with correct subclass.

Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue zfsonlinux/zfs#4665
Closes #549
This commit is contained in:
Chunwei Chen
2016-05-18 11:28:46 -07:00
committed by Brian Behlendorf
parent 39cd90ef08
commit fdbc1ba99d
3 changed files with 45 additions and 2 deletions
+2 -1
View File
@@ -352,7 +352,8 @@ spl_kern_path_locked(const char *name, struct path *path)
if (rc)
return (ERR_PTR(rc));
spl_inode_lock(parent.dentry->d_inode);
/* use I_MUTEX_PARENT because vfs_unlink needs it */
spl_inode_lock_nested(parent.dentry->d_inode, I_MUTEX_PARENT);
dentry = lookup_one_len(basename, parent.dentry, len);
if (IS_ERR(dentry)) {