On Sat, 26 Feb 2022 at 17:38, Amir Goldstein <amir73il@xxxxxxxxx> wrote: > > On Sat, Feb 26, 2022 at 5:21 PM Chengguang Xu <cgxu519@xxxxxxxxxxxx> wrote: > > > > Calling fsync for parent directory in copy-up to > > ensure the change get synced. > > It is not clear to me that this change is really needed > What if the reported problem? > > Besides this can impact performance in some workloads. > > The difference between parent copy up and file copy up is that > failing to fsync to copied up data and linking/moving the upper file > into place may result in corrupted data after power failure if temp > file data is not synced. > > Failing the fsync the parent dir OTOH may result in revert to > lower file data after power failure. > > The thing is, although POSIX gives you no such guarantee, with > ext4/xfs fsync of the upper file itself will guarantee that parents > will be present after power failure (see [1]). > > This is not true for btrfs, but there are fewer users using overlayfs > over btrfs (at least in the container world). > > So while your patch is certainly "correct", for most users its effects > will be only negative - performance penalty without fixing anything. > So I think this change should be opt-in with Kconfig/module/mount option. Probably should be made conditional on ovl_should_sync(ofs). But before adding more options/complexity the performance impact itself should be evaluated. My guess is that it will be minimal, since directory copy ups will generally be orders of magnitude less frequent than file copy ups. Thanks, Miklos