Re: [PATCH] ovl: skip overlayfs superblocks at global sync
From: Amir Goldstein
Date: Sun Apr 12 2020 - 02:47:13 EST
On Sun, Apr 12, 2020 at 1:29 AM Dave Chinner <david@xxxxxxxxxxxxx> wrote:
>
> On Thu, Apr 09, 2020 at 11:29:47AM +0300, Konstantin Khlebnikov wrote:
> > Stacked filesystems like overlayfs has no own writeback, but they have to
> > forward syncfs() requests to backend for keeping data integrity.
> >
> > During global sync() each overlayfs instance calls method ->sync_fs()
> > for backend although it itself is in global list of superblocks too.
> > As a result one syscall sync() could write one superblock several times
> > and send multiple disk barriers.
> >
> > This patch adds flag SB_I_SKIP_SYNC into sb->sb_iflags to avoid that.
>
> Why wouldn't you just remove the ->sync_fs method from overlay?
>
> I mean, if you don't need the filesystem to do anything special for
> one specific data integrity sync_fs call, you don't need it for any
> of them, yes?
>
No, but I understand the confusion.
Say you have 1000 overlay sb's all of them using upper directories
from a single xfs sb (quite common for containers).
syncfs(2) of each overlay, must call sync_fs of xfs (see ovl_sync_fs)
sync(2) will call xfs sync_fs anyway, so there is no point in calling
ovl_sync_fs => xfs sync_fs 1000 more times.
Thanks,
Amir.