Re: [PATCH 01/18] vfs: introduce new file range exchange ioctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 31, 2021 at 06:08:52PM -0700, Darrick J. Wong wrote:

> +	ret = vfs_xchg_file_range(file1.file, file2, &args);
> +	if (ret)
> +		goto fdput;
> +
> +	/*
> +	 * The VFS will set RANGE_FSYNC on its own if the file or inode require
> +	 * synchronous writes.  Don't leak this back to userspace.
> +	 */
> +	args.flags &= ~FILE_XCHG_RANGE_FSYNC;
> +	args.flags |= (old_flags & FILE_XCHG_RANGE_FSYNC);
> +
> +	if (copy_to_user(argp, &args, sizeof(args)))
> +		ret = -EFAULT;

Erm...  How is userland supposed to figure out whether that EFAULT
came before or after the operation?  Which of the fields are outputs,
anyway?

> +	/* Don't touch certain kinds of inodes */
> +	if (IS_IMMUTABLE(inode1) || IS_IMMUTABLE(inode2))
> +		return -EPERM;

Append-only should get the same treatment (and IMO if you have
O_APPEND on either file, you should get a failure as well).



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux