Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a561be71 authored by Al Viro's avatar Al Viro
Browse files

switch a bunch of places to mnt_want_write_file()



it's both faster (in case when file has been opened for write) and cleaner.

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent f47ec3f2
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -201,7 +201,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
		}
		}
	}
	}


	ret = mnt_want_write(file->f_path.mnt);
	ret = mnt_want_write_file(file);
	if (ret)
	if (ret)
		goto out_unlock;
		goto out_unlock;


@@ -1855,7 +1855,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
		goto out;
		goto out;
	}
	}


	err = mnt_want_write(file->f_path.mnt);
	err = mnt_want_write_file(file);
	if (err)
	if (err)
		goto out;
		goto out;


@@ -1987,7 +1987,7 @@ static int btrfs_ioctl_defrag(struct file *file, void __user *argp)
	if (btrfs_root_readonly(root))
	if (btrfs_root_readonly(root))
		return -EROFS;
		return -EROFS;


	ret = mnt_want_write(file->f_path.mnt);
	ret = mnt_want_write_file(file);
	if (ret)
	if (ret)
		return ret;
		return ret;


@@ -2195,7 +2195,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
	if (btrfs_root_readonly(root))
	if (btrfs_root_readonly(root))
		return -EROFS;
		return -EROFS;


	ret = mnt_want_write(file->f_path.mnt);
	ret = mnt_want_write_file(file);
	if (ret)
	if (ret)
		return ret;
		return ret;


@@ -2549,7 +2549,7 @@ static long btrfs_ioctl_trans_start(struct file *file)
	if (btrfs_root_readonly(root))
	if (btrfs_root_readonly(root))
		goto out;
		goto out;


	ret = mnt_want_write(file->f_path.mnt);
	ret = mnt_want_write_file(file);
	if (ret)
	if (ret)
		goto out;
		goto out;


+3 −3
Original line number Original line Diff line number Diff line
@@ -35,7 +35,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
	case EXT2_IOC_SETFLAGS: {
	case EXT2_IOC_SETFLAGS: {
		unsigned int oldflags;
		unsigned int oldflags;


		ret = mnt_want_write(filp->f_path.mnt);
		ret = mnt_want_write_file(filp);
		if (ret)
		if (ret)
			return ret;
			return ret;


@@ -91,7 +91,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
	case EXT2_IOC_SETVERSION:
	case EXT2_IOC_SETVERSION:
		if (!inode_owner_or_capable(inode))
		if (!inode_owner_or_capable(inode))
			return -EPERM;
			return -EPERM;
		ret = mnt_want_write(filp->f_path.mnt);
		ret = mnt_want_write_file(filp);
		if (ret)
		if (ret)
			return ret;
			return ret;
		if (get_user(inode->i_generation, (int __user *) arg)) {
		if (get_user(inode->i_generation, (int __user *) arg)) {
@@ -121,7 +121,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		if (get_user(rsv_window_size, (int __user *)arg))
		if (get_user(rsv_window_size, (int __user *)arg))
			return -EFAULT;
			return -EFAULT;


		ret = mnt_want_write(filp->f_path.mnt);
		ret = mnt_want_write_file(filp);
		if (ret)
		if (ret)
			return ret;
			return ret;


+5 −5
Original line number Original line Diff line number Diff line
@@ -44,7 +44,7 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		if (get_user(flags, (int __user *) arg))
		if (get_user(flags, (int __user *) arg))
			return -EFAULT;
			return -EFAULT;


		err = mnt_want_write(filp->f_path.mnt);
		err = mnt_want_write_file(filp);
		if (err)
		if (err)
			return err;
			return err;


@@ -126,7 +126,7 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		if (!inode_owner_or_capable(inode))
		if (!inode_owner_or_capable(inode))
			return -EPERM;
			return -EPERM;


		err = mnt_want_write(filp->f_path.mnt);
		err = mnt_want_write_file(filp);
		if (err)
		if (err)
			return err;
			return err;
		if (get_user(generation, (int __user *) arg)) {
		if (get_user(generation, (int __user *) arg)) {
@@ -164,7 +164,7 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		if (!test_opt(inode->i_sb, RESERVATION) ||!S_ISREG(inode->i_mode))
		if (!test_opt(inode->i_sb, RESERVATION) ||!S_ISREG(inode->i_mode))
			return -ENOTTY;
			return -ENOTTY;


		err = mnt_want_write(filp->f_path.mnt);
		err = mnt_want_write_file(filp);
		if (err)
		if (err)
			return err;
			return err;


@@ -206,7 +206,7 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		if (!capable(CAP_SYS_RESOURCE))
		if (!capable(CAP_SYS_RESOURCE))
			return -EPERM;
			return -EPERM;


		err = mnt_want_write(filp->f_path.mnt);
		err = mnt_want_write_file(filp);
		if (err)
		if (err)
			return err;
			return err;


@@ -232,7 +232,7 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		if (!capable(CAP_SYS_RESOURCE))
		if (!capable(CAP_SYS_RESOURCE))
			return -EPERM;
			return -EPERM;


		err = mnt_want_write(filp->f_path.mnt);
		err = mnt_want_write_file(filp);
		if (err)
		if (err)
			return err;
			return err;


+7 −7
Original line number Original line Diff line number Diff line
@@ -45,7 +45,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		if (get_user(flags, (int __user *) arg))
		if (get_user(flags, (int __user *) arg))
			return -EFAULT;
			return -EFAULT;


		err = mnt_want_write(filp->f_path.mnt);
		err = mnt_want_write_file(filp);
		if (err)
		if (err)
			return err;
			return err;


@@ -150,7 +150,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		if (!inode_owner_or_capable(inode))
		if (!inode_owner_or_capable(inode))
			return -EPERM;
			return -EPERM;


		err = mnt_want_write(filp->f_path.mnt);
		err = mnt_want_write_file(filp);
		if (err)
		if (err)
			return err;
			return err;
		if (get_user(generation, (int __user *) arg)) {
		if (get_user(generation, (int __user *) arg)) {
@@ -192,7 +192,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
			return -EOPNOTSUPP;
			return -EOPNOTSUPP;
		}
		}


		err = mnt_want_write(filp->f_path.mnt);
		err = mnt_want_write_file(filp);
		if (err)
		if (err)
			return err;
			return err;


@@ -240,7 +240,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
			return -EOPNOTSUPP;
			return -EOPNOTSUPP;
		}
		}


		err = mnt_want_write(filp->f_path.mnt);
		err = mnt_want_write_file(filp);
		if (err)
		if (err)
			goto mext_out;
			goto mext_out;


@@ -277,7 +277,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
			return -EOPNOTSUPP;
			return -EOPNOTSUPP;
		}
		}


		err = mnt_want_write(filp->f_path.mnt);
		err = mnt_want_write_file(filp);
		if (err)
		if (err)
			return err;
			return err;


@@ -301,7 +301,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		if (!inode_owner_or_capable(inode))
		if (!inode_owner_or_capable(inode))
			return -EACCES;
			return -EACCES;


		err = mnt_want_write(filp->f_path.mnt);
		err = mnt_want_write_file(filp);
		if (err)
		if (err)
			return err;
			return err;
		/*
		/*
@@ -323,7 +323,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		if (!inode_owner_or_capable(inode))
		if (!inode_owner_or_capable(inode))
			return -EACCES;
			return -EACCES;


		err = mnt_want_write(filp->f_path.mnt);
		err = mnt_want_write_file(filp);
		if (err)
		if (err)
			return err;
			return err;
		err = ext4_alloc_da_blocks(inode);
		err = ext4_alloc_da_blocks(inode);
+1 −1
Original line number Original line Diff line number Diff line
@@ -44,7 +44,7 @@ static int fat_ioctl_set_attributes(struct file *file, u32 __user *user_attr)
		goto out;
		goto out;


	mutex_lock(&inode->i_mutex);
	mutex_lock(&inode->i_mutex);
	err = mnt_want_write(file->f_path.mnt);
	err = mnt_want_write_file(file);
	if (err)
	if (err)
		goto out_unlock_inode;
		goto out_unlock_inode;


Loading