]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ovl: fsync after metadata copy-up
authorAmir Goldstein <amir73il@gmail.com>
Thu, 29 Aug 2024 15:51:08 +0000 (17:51 +0200)
committerAmir Goldstein <amir73il@gmail.com>
Fri, 30 Aug 2024 12:18:37 +0000 (14:18 +0200)
commit7d6899fb69d25e1bc6f4700b7c1d92e6b608593d
treefb547e20be992b1744bcd05d3831c024b1fb37b3
parent34b4540e6646577d02afacfcbc08e563b7d69a9f
ovl: fsync after metadata copy-up

For upper filesystems which do not use strict ordering of persisting
metadata changes (e.g. ubifs), when overlayfs file is modified for
the first time, copy up will create a copy of the lower file and
its parent directories in the upper layer. Permission lost of the
new upper parent directory was observed during power-cut stress test.

Fix by moving the fsync call to after metadata copy to make sure that the
metadata copied up directory and files persists to disk before renaming
from tmp to final destination.

With metacopy enabled, this change will hurt performance of workloads
such as chown -R, so we keep the legacy behavior of fsync only on copyup
of data.

Link: https://lore.kernel.org/linux-unionfs/CAOQ4uxj-pOvmw1-uXR3qVdqtLjSkwcR9nVKcNU_vC10Zyf2miQ@mail.gmail.com/
Reported-and-tested-by: Fei Lv <feilv@asrmicro.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
fs/overlayfs/copy_up.c