On Thu, Jan 31, 2019 at 04:44:39PM +0000, Hugo Mills wrote: > On Thu, Jan 31, 2019 at 04:39:22PM +0000, Filipe Manana wrote: > > On Thu, Dec 13, 2018 at 4:08 PM David Sterba <dsterba@xxxxxxx> wrote: > > > > > > On Wed, Dec 12, 2018 at 06:05:58PM +0000, fdmanana@xxxxxxxxxx wrote: > > > > From: Filipe Manana <fdmanana@xxxxxxxx> > > > > > > > > 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 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). > > > > 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. > > Only if you want your incremental send chain to break on the way > past... > > I think it's fairly clear by now (particularly from the last thread > on this a couple of weeks ago) that making RO subvols RW and then back > again is a fast way to broken incremental receives. So, I think the way it should be fixed is to keep deduplication off the read-only subvolumes. The main reason I see is to avoid the random problems that arise from send + dedupe interaction. The cost is lower deduplication ratio. The main usecase being a primary subvolume with RO snapshots over time, with optional incremental send. That I know is common and widely used. A problematic usecase that would utilize deduplication over RO snapshots does could be something like a set of subvolumes that have very similar data, get snapshotted or set RO, followed by a dedupe pass. To support the latter I'd go only via the RO->RW, dedupe, RW->RO way, as this records that there was a change and does not collide with send assumptions. That this leads to loss of incremental send must be communicated to the user with possible override, eg. --I-know-what-I-am-doing option.
