On Mon, Nov 16, 2020 at 4:42 PM Vivek Goyal <vgoyal@xxxxxxxxxx> 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). > Do note that the latest patch set by Chengguang not only syncs dirty inodes of this overlay instance, but also waits for in-flight writeback on all the upper fs inodes and I think that with !ovl_should_sync(ofs) we will not re-dirty the ovl inodes and lose track of the list of dirty inodes - maybe that can be fixed. Also, I am not sure anymore that we can safely remove the dirty file after sync dirty inodes sync_fs and umount. If someone did sync_fs before us and consumed the error, we may have a copied up file in upper whose data is not on disk, but when we sync_fs on unmount we won't get an error? not sure. I am less concerned about ways to allow re-mount of volatile overlayfs than I am about turning volatile overlayfs into non-volatile. Thanks, Amir.