--- a/vfs.c +++ b/vfs.c @@ -544,15 +544,9 @@ int cifsd_vfs_setattr(struct cifsd_work attrs->ia_valid |= ATTR_CTIME; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) - inode_lock(inode); - err = notify_change(dentry, attrs, NULL); - inode_unlock(inode); -#else mutex_lock(&inode->i_mutex); err = notify_change(dentry, attrs, NULL); mutex_unlock(&inode->i_mutex); -#endif if (update_size) put_write_access(inode); @@ -753,11 +747,8 @@ int cifsd_vfs_remove_file(char *name) if (!dir->d_inode) goto out; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) - inode_lock_nested(dir->d_inode, I_MUTEX_PARENT); -#else mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); -#endif + dentry = lookup_one_len(last, dir, strlen(last)); if (IS_ERR(dentry)) { err = PTR_ERR(dentry); @@ -783,11 +774,7 @@ int cifsd_vfs_remove_file(char *name) dput(dentry); out_err: -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) - inode_unlock(dir->d_inode); -#else mutex_unlock(&dir->d_inode->i_mutex); -#endif out: path_put(&parent); return err; @@ -1302,11 +1289,8 @@ int cifsd_vfs_unlink(struct dentry *dir, int err = 0; dget(dentry); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) - inode_lock(dir->d_inode); -#else mutex_lock(&dir->d_inode->i_mutex); -#endif + if (!dentry->d_inode || !dentry->d_inode->i_nlink) { err = -ENOENT; goto out; @@ -1318,11 +1302,8 @@ int cifsd_vfs_unlink(struct dentry *dir, err = vfs_unlink(dir->d_inode, dentry, NULL); out: -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) - inode_unlock(dir->d_inode); -#else mutex_unlock(&dir->d_inode->i_mutex); -#endif + dput(dentry); if (err) cifsd_debug("failed to delete, err %d\n", err);