]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
restore killability of old mutex_lock_killable(&inode->i_mutex) users
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 26 May 2016 04:05:12 +0000 (00:05 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 26 May 2016 04:13:25 +0000 (00:13 -0400)
The ones that are taking it exclusive, that is...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/btrfs/ioctl.c
fs/overlayfs/readdir.c
fs/readdir.c

index 4e700694b741c161951cd7a705b436335dd6cae3..c24473fac2fbfa9bb836ae070faf0befef287d93 100644 (file)
@@ -846,11 +846,9 @@ static noinline int btrfs_mksubvol(struct path *parent,
        struct dentry *dentry;
        int error;
 
-       inode_lock_nested(dir, I_MUTEX_PARENT);
-       // XXX: should've been
-       // mutex_lock_killable_nested(&dir->i_mutex, I_MUTEX_PARENT);
-       // if (error == -EINTR)
-       //      return error;
+       error = down_write_killable_nested(&dir->i_rwsem, I_MUTEX_PARENT);
+       if (error == -EINTR)
+               return error;
 
        dentry = lookup_one_len(name, parent->dentry, namelen);
        error = PTR_ERR(dentry);
@@ -2377,11 +2375,9 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
                goto out;
 
 
-       inode_lock_nested(dir, I_MUTEX_PARENT);
-       // XXX: should've been
-       // err = mutex_lock_killable_nested(&dir->i_mutex, I_MUTEX_PARENT);
-       // if (err == -EINTR)
-       //      goto out_drop_write;
+       err = down_write_killable_nested(&dir->i_rwsem, I_MUTEX_PARENT);
+       if (err == -EINTR)
+               goto out_drop_write;
        dentry = lookup_one_len(vol_args->name, parent, namelen);
        if (IS_ERR(dentry)) {
                err = PTR_ERR(dentry);
@@ -2571,7 +2567,7 @@ out_dput:
        dput(dentry);
 out_unlock_dir:
        inode_unlock(dir);
-//out_drop_write:
+out_drop_write:
        mnt_drop_write_file(file);
 out:
        kfree(vol_args);
index da186ee4f846820703fa1a2fffb290c876991f1e..9e79f6458dfbfc564eab296d0d96d15ee491506a 100644 (file)
@@ -218,9 +218,7 @@ static int ovl_check_whiteouts(struct dentry *dir, struct ovl_readdir_data *rdd)
        cap_raise(override_cred->cap_effective, CAP_DAC_OVERRIDE);
        old_cred = override_creds(override_cred);
 
-       inode_lock(dir->d_inode);
-       err = 0;
-       // XXX: err = mutex_lock_killable(&dir->d_inode->i_mutex);
+       err = down_write_killable(&dir->d_inode->i_rwsem);
        if (!err) {
                while (rdd->first_maybe_whiteout) {
                        p = rdd->first_maybe_whiteout;
index 68ef06efe6bc4a530133d54e57833330a1b40470..9d0212c374d6db316dcafcd278e5b511a1eec6d2 100644 (file)
@@ -35,13 +35,13 @@ int iterate_dir(struct file *file, struct dir_context *ctx)
        if (res)
                goto out;
 
-       if (shared)
+       if (shared) {
                inode_lock_shared(inode);
-       else
-               inode_lock(inode);
-       // res = mutex_lock_killable(&inode->i_mutex);
-       // if (res)
-       //      goto out;
+       } else {
+               res = down_write_killable(&inode->i_rwsem);
+               if (res)
+                       goto out;
+       }
 
        res = -ENOENT;
        if (!IS_DEADDIR(inode)) {