Re: [PATCH 2/2] btrfs-progs: defrag: open files RO on new enough kernels or if root

2018-09-03 Thread Adam Borowski
On Mon, Sep 03, 2018 at 02:04:23PM +0300, Nikolay Borisov wrote: > On 3.09.2018 13:14, Adam Borowski wrote: > > - fd = open(fpath, O_RDWR); > > + fd = open(fpath, defrag_ro); > > Looking at the kernel code I think this is in fact incorrect, because in > ioctl.c we have: > >

Re: [PATCH 2/2] btrfs-progs: defrag: open files RO on new enough kernels or if root

2018-09-03 Thread Adam Borowski
On Mon, Sep 03, 2018 at 02:01:21PM +0300, Nikolay Borisov wrote: > On 3.09.2018 13:14, Adam Borowski wrote: > > Fixes EXTXBSY races. > > You have to be more eloquent than that and explain at least one race > condition. If you try to defrag an executable that's currently running: ERROR: cannot

Re: [PATCH 2/2] btrfs-progs: defrag: open files RO on new enough kernels or if root

2018-09-03 Thread Nikolay Borisov
On 3.09.2018 13:14, Adam Borowski wrote: > Fixes EXTXBSY races. > > Signed-off-by: Adam Borowski > --- > cmds-filesystem.c | 10 -- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/cmds-filesystem.c b/cmds-filesystem.c > index 06c8311b..4c9df69f 100644 > ---

Re: [PATCH 2/2] btrfs-progs: defrag: open files RO on new enough kernels or if root

2018-09-03 Thread Nikolay Borisov
On 3.09.2018 13:14, Adam Borowski wrote: > Fixes EXTXBSY races. You have to be more eloquent than that and explain at least one race condition. > > Signed-off-by: Adam Borowski > --- > cmds-filesystem.c | 10 -- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git

[PATCH 2/2] btrfs-progs: defrag: open files RO on new enough kernels or if root

2018-09-03 Thread Adam Borowski
Fixes EXTXBSY races. Signed-off-by: Adam Borowski --- cmds-filesystem.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cmds-filesystem.c b/cmds-filesystem.c index 06c8311b..4c9df69f 100644 --- a/cmds-filesystem.c +++ b/cmds-filesystem.c @@ -26,6 +26,7 @@