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: > > if (!(file->f_mode & FMODE_WRITE)) { > > ret = -EINVAL; > > goto out; > > } > > So it seems a hard requirement to have opened a file for RW when you > want to defragment it.
Oif! I confused this with dedup, which does allow root to dedup RO even on old kernels. Good catch. -- ⢀⣴⠾⠻⢶⣦⠀ What Would Jesus Do, MUD/MMORPG edition: ⣾⠁⢰⠒⠀⣿⡁ • multiplay with an admin char to benefit your mortal [Mt3:16-17] ⢿⡄⠘⠷⠚⠋⠀ • abuse item cloning bugs [Mt14:17-20, Mt15:34-37] ⠈⠳⣄⠀⠀⠀⠀ • use glitches to walk on water [Mt14:25-26]