Re: [PATCH] btrfs,vfs: allow FILE_EXTENT_SAME on a file opened ro

2016-05-30 Thread Adam Borowski
On Sat, May 28, 2016 at 08:56:39PM -0400, Zygo Blaxell wrote: > On Sun, May 29, 2016 at 02:21:03AM +0200, Adam Borowski wrote: > > In any case, this patch doesn't introduce any cases not already triggerable > > by root. > > It allows non-root to trigger cases that previously could only be >

Re: [PATCH] btrfs,vfs: allow FILE_EXTENT_SAME on a file opened ro

2016-05-29 Thread Andrei Borzenkov
29.05.2016 03:56, Zygo Blaxell пишет: >> >> I don't think this can happen on btrfs: the superblock is updated only after >> a barrier when both the data and extent refs are already on the disk. > > If and only if the filesystem is mounted with the flushoncommit option, > that's true. This is not

Re: [PATCH] btrfs,vfs: allow FILE_EXTENT_SAME on a file opened ro

2016-05-28 Thread Zygo Blaxell
On Sun, May 29, 2016 at 02:21:03AM +0200, Adam Borowski wrote: > On Fri, May 27, 2016 at 09:59:22PM -0400, Zygo Blaxell wrote: > > I wonder if there is a risk of damaging files like this: > > > > open A O_RDWR > > > > open B O_RDONLY > > > > copy B to A > > > > do _not_ call

Re: [PATCH] btrfs,vfs: allow FILE_EXTENT_SAME on a file opened ro

2016-05-28 Thread Adam Borowski
On Fri, May 27, 2016 at 09:59:22PM -0400, Zygo Blaxell wrote: > On Thu, May 26, 2016 at 05:04:01PM -0700, Mark Fasheh wrote: > > On Fri, May 20, 2016 at 05:45:12AM +0200, Adam Borowski wrote: > > > (Only btrfs currently implements dedupe_file_range.) > > > > > > Instead of checking the mode of

Re: [PATCH] btrfs,vfs: allow FILE_EXTENT_SAME on a file opened ro

2016-05-27 Thread Zygo Blaxell
On Thu, May 26, 2016 at 05:04:01PM -0700, Mark Fasheh wrote: > On Fri, May 20, 2016 at 05:45:12AM +0200, Adam Borowski wrote: > > (Only btrfs currently implements dedupe_file_range.) > > > > Instead of checking the mode of the file descriptor, let's check whether > > it could have been opened rw.

Re: [PATCH] btrfs,vfs: allow FILE_EXTENT_SAME on a file opened ro

2016-05-26 Thread Adam Borowski
On Thu, May 26, 2016 at 05:04:01PM -0700, Mark Fasheh wrote: > On Fri, May 20, 2016 at 05:45:12AM +0200, Adam Borowski wrote: > > (Only btrfs currently implements dedupe_file_range.) > > > > Instead of checking the mode of the file descriptor, let's check whether > > it could have been opened rw.

Re: [PATCH] btrfs,vfs: allow FILE_EXTENT_SAME on a file opened ro

2016-05-26 Thread Mark Fasheh
On Fri, May 20, 2016 at 05:45:12AM +0200, Adam Borowski wrote: > (Only btrfs currently implements dedupe_file_range.) > > Instead of checking the mode of the file descriptor, let's check whether > it could have been opened rw. This allows fixing failures when deduping > a live system: anyone

Re: [PATCH] btrfs,vfs: allow FILE_EXTENT_SAME on a file opened ro

2016-05-26 Thread Adam Borowski
On Fri, May 20, 2016 at 05:45:12AM +0200, Adam Borowski wrote: > (Only btrfs currently implements dedupe_file_range.) > > Instead of checking the mode of the file descriptor, let's check whether > it could have been opened rw. This allows fixing failures when deduping > a live system: anyone

[PATCH] btrfs,vfs: allow FILE_EXTENT_SAME on a file opened ro

2016-05-19 Thread Adam Borowski
(Only btrfs currently implements dedupe_file_range.) Instead of checking the mode of the file descriptor, let's check whether it could have been opened rw. This allows fixing failures when deduping a live system: anyone trying to exec a file currently being deduped gets ETXTBSY. Issuing this