Thread (30 messages) flat view 30 messages, 4 authors, 2021-04-05

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

From: Al Viro <viro@zeniv.linux.org.uk>
Date: 2021-04-01 01:44:58
Also in: linux-fsdevel, linux-xfs

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).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help