On Thu, Jan 31, 2019 at 04:39:22PM +0000, Filipe Manana wrote: > On Thu, Dec 13, 2018 at 4:08 PM David Sterba wrote: > > > > On Wed, Dec 12, 2018 at 06:05:58PM +0000, fdmanana@kernel.org wrote: > > > From: Filipe Manana > > > > > > Checking if the destination root is read-only was being performed only for > > > clone operations. Make deduplication check it as well, as it does not make > > > sense to not do it, even if it is an operation that does not change the > > > file contents (such as defrag for example, which checks first if the root > > > is read-only). > > > > And this is also change in user-visible behaviour of dedupe, so this > > needs to be verified if it's not breaking existing tools. > > Have you had the chance to do such verification? > > This actually conflicts with send. Send does not expect a root/tree to > change, and with dedupe on read-only roots happening > in parallel with send is going to cause all sorts of unexpected and > undesired problems... This is a problem bees ran into. There is a workaround in bees (called --workaround-btrfs-send) that avoids RO subvols as dedupe targets. As the name of the option implies, it works around problems in btrfs send. This kernel change makes the workaround mandatory now, as the default case (without workaround) will fail on every RO subvol even if that behavior is desired by the user. That breaks an important use case on the receiving side of sends--to dedupe the received subvols together while also protecting them against modification on the target system with the RO flag--and preserving that use case is why the send workaround was optional (and not default) in bees. bees also won't handle the RO/RW/RO transition correctly, as it didn't seem like a sane thing to support at the time. That is arguably something to be fixed in bees. > This is a problem introduced by dedupe ioctl when it landed, since > send existed for a longer time (when nothing else was > allowed to change read-only roots, including defrag). Is there a reason why incremental send can't simply be fixed? As far as I can tell, send is failing because of a runtime check that seems to be too strict; however, I haven't tried removing that check to see if it fixes the problem in send, or just hides the next problem. More details at: https://github.com/Zygo/bees/issues/79#issuecomment-429039036 > I understand it can break some applications, but adding other solution > such as preventing send and dedupe from running in parallel > (erroring out or block and wait for each other, etc) is going to be > really ugly. There's always the workaround for apps to set the > subvolume > to RW mode, do the dedupe, then switch it back to RO mode. > > Thanks.