On Mon, Dec 03, 2018 at 11:17:05AM +0100, Jan Tulak wrote: > On Sun, Dec 2, 2018 at 9:54 PM Dave Chinner <david@xxxxxxxxxxxxx> wrote: > > > > From: Dave Chinner <dchinner@xxxxxxxxxx> > > > > I need to be able to open a file read-write, then change the > > permissions on the file to read-only to check that copy_file_range > > returns EPERM correctly in that case. This can't be done as root, > > because root ignores file permissions, but as a normal user we can't > > open a 0444 file for writing and so can't actually test writing to > > a read-only file without some method of "open read-write, change > > permissions to read-only, try to write to file through open > > read-write file". > > > > So, allow adding or removing write permissions on an open file. > > > > Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx> > > Should there be a man page update as well? Other commands from open.c > have a corresponding man section, but: > $ grep -c chmod man/man8/xfs_io.8 > 0 I forgot that, thanks. So many other things to deal with. > And I wonder if the two permissions (0444 and 0664) are enough, or we > might want to add other modes as well. But maybe that can be added > when the need comes... Otherwise it looks good. If we need more than "make read-only" or "make read-write" then we can do something more. But for pretty much all the cases where fine grained permissions are needed, the chmod command itself should suffice.... Cheers, Dave. -- Dave Chinner david@xxxxxxxxxxxxx