Re: [PATCH v7 0/7] ovl: only sync what was written through the overlay
From: Amir Goldstein
Date: Fri Nov 20 2026 - 07:02:21 EST
On Wed, Nov 18, 2026 at 7:14 PM Amir Goldstein <amir73il@xxxxxxxxx> wrote:
>
> On Wed, Nov 18, 2026 at 6:03 PM Josef Bacik <josef@xxxxxxxxxxxxxx> wrote:
> >
> > v1: https://lore.kernel.org/all/20261027-b4-ovl-containerized-sync-v1-0-802e512379a6@xxxxxxxxxxxxxx/
> > v2: https://lore.kernel.org/all/20261029-b4-ovl-containerized-sync-v2-0-4e9f08e4a052@xxxxxxxxxxxxxx/
> > v3: https://lore.kernel.org/all/20261104-b4-ovl-containerized-sync-v3-0-8daa20144f53@xxxxxxxxxxxxxx/
> > v4: https://lore.kernel.org/all/20261106-b4-ovl-containerized-sync-v4-0-6ddde0b7dd8a@xxxxxxxxxxxxxx/
> > v5: https://lore.kernel.org/all/20261107-b4-ovl-containerized-sync-v5-0-d34b4ae57fdf@xxxxxxxxxxxxxx/
> > v6: https://lore.kernel.org/all/20261110-b4-ovl-containerized-sync-v6-0-43d1be16a4d6@xxxxxxxxxxxxxx/
> >
> > I've completely redesigned this, because there were so many problems
> > that I kept tripping over trying to maintain state between the upper and
> > the lower inode. I'm not in love with this design either, but it's the
> > simplest. I'm hoping somebody spots something obvious and we can do it a
> > different way.
>
I assume that you asked your alter ego Claude this question, because it gave me
some tips of how to do it differently.
I guess it depends on how you ask...
I asked for less complexity, easier to review, and keep the requirements
that syncfs duration remains low in the worst case.
I also asked to look at Chengguang's v12 work from 2020 which
I remembered was simpler to review, but had some problems:
https://lore.kernel.org/r/20200506095307.23742-1-cgxu519@xxxxxxxxxxxx/
I got a few suggestions that I liked:
1. Serialize syncfs calls with ovl s_sync_lock and use dirty list as v12 did
One list for the tracked/dirty
local spliced list for syncfs
Which workload would it hurt? anything important?
Certainly won't matter for the unmount case that triggered this patch set.
Holding upper s_umount shared during the walk will remove complexity
around freeze of upper and reduces the 3 states to just one dirty/tracked state.
Less logic to reason about.
2. Replace inode references and shrinker with reclaim list
Only an evicted tracked an linked ovl_inode needs to be added to the
reclaim list and ihold the upper inode
syncfs synced the tracked list (no extra upper ref) and the reclaim
list (with extra upper ref)
This should get rid of the shrinker hooks
This is not simple but maybe a lesser evil than the shrinkers?
Not sure.
3. Try to gate more ovl_track_inode() in existing helpers
Similar to ovl_copyattr()
Many metadata modification already have to be gated by ovl_drop_write()
or the higher level ovl_{rename,link}_end()
we can add both old new to the rename helper
even make them scoped
I will wait for your feedback before diving into review of v7.
Thanks,
Amir.