On Mon, Nov 16, 2020 at 09:42:40AM -0500, Vivek Goyal wrote: > On Sun, Nov 15, 2020 at 08:57:58PM -0800, Sargun Dhillon wrote: > > Overlayfs added the ability to setup mounts where all syncs could be > > short-circuted in (2a99ddacee43: ovl: provide a mount option "volatile"). > > > > A user might want to remount this fs, but we do not let the user because > > of the "incompat" detection feature. In the case of volatile, it is safe > > to do something like[1]: > > > > $ sync -f /root/upperdir > > $ rm -rf /root/workdir/incompat/volatile > > > > There are two ways to go about this. You can call sync on the underlying > > filesystem, check the error code, and delete the dirty file if everything > > is clean. If you're running lots of containers on the same filesystem, or > > you want to avoid all unnecessary I/O, this may be suboptimal. > > > > Hi Sargun, > > I had asked bunch of questions in previous mail thread to be more > clear on your requirements but never got any response. It would > have helped understanding your requirements better. > > How about following patch set which seems to sync only dirty inodes of > upper belonging to a particular overlayfs instance. > > https://lore.kernel.org/linux-unionfs/20201113065555.147276-1-cgxu519@xxxxxxxxxxxx/ > > So if could implement a mount option which ignores fsync but upon > syncfs, only syncs dirty inodes of that overlayfs instance, it will > make sure we are not syncing whole of the upper fs. And we could > do this syncing on unmount of overlayfs and remove dirty file upon > successful sync. > > Looks like this will be much simpler method and should be able to > meet your requirements (As long as you are fine with syncing dirty > upper inodes of this overlay instance on unmount). This approach also has the advantage error detection is much more granular and you don't have to throw away container A if there was a writeback issue in any other unrelated container N sharing same upper. Thanks Vivek