From: Joanne Koong <joannelkoong@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: brauner@kernel.org, linux-fsdevel@vger.kernel.org,
miklos@szeredi.hu, david@kernel.org, therealgraysky@proton.me,
linux-pm@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v1] writeback: skip sync(2) inode writeback for filesystems with no data integrity guarantees
Date: Thu, 19 Mar 2026 11:07:42 -0700 [thread overview]
Message-ID: <CAJnrk1Z7OTah=zam8_4LWx8Kc0B6omrVbiiDRNHm34yAKNEBEA@mail.gmail.com> (raw)
In-Reply-To: <k7ln2mcmll3t4zic3smao6hvvxprmpsax45fh6mwn4en6f6m42@sdpuqd2pqiwy>
On Thu, Mar 19, 2026 at 5:42 AM Jan Kara <jack@suse.cz> wrote:
>
> On Wed 18-03-26 15:56:04, Joanne Koong wrote:
> > Add SB_I_NO_DATA_INTEGRITY superblock flag for filesystems that cannot
> > guarantee data persistence on sync (eg fuse) and skip sync(2) inode
> > writeback for superblocks with this flag set.
> >
> > There was a recent report [1] for a suspend-to-RAM hang on fuse-overlayfs with
> > firefox + youtube in wb_wait_for_completion() from the pm_fs_sync_work_fn()
> > path:
> >
> > Workqueue: pm_fs_sync pm_fs_sync_work_fn
> > Call Trace:
> > <TASK>
> > __schedule+0x457/0x1720
> > schedule+0x27/0xd0
> > wb_wait_for_completion+0x97/0xe0
> > sync_inodes_sb+0xf8/0x2e0
> > __iterate_supers+0xdc/0x160
> > ksys_sync+0x43/0xb0
> > pm_fs_sync_work_fn+0x17/0xa0
> > process_one_work+0x193/0x350
> > worker_thread+0x1a1/0x310
> > kthread+0xfc/0x240
> > ret_from_fork+0x243/0x280
> > ret_from_fork_asm+0x1a/0x30
> > </TASK>
> >
> > This can happen in two ways:
> > a) systemd freezes the user session cgroups first (which freezes the fuse daemon)
> > before invoking the kernel suspend. The suspend triggers the wb_workfn() ->
> > write_inode() path, where fuse issues a synchronous setattr request to the
> > frozen daemon, which cannot process the request
> > b) if a dirty folio is already under writeback and needs to have writeback
> > issued again, in writeback_get_folio() -> folio_prepare_writeback(), we
> > unconditionally wait on writeback to finish, but for buggy/faulty fuse
> > servers, the request may never be processed
> >
> > The correct fix is for sync(2) to skip the sync_inodes_sb() path entirely for
> > any filesystems that do not have data integrity guarantees.
> >
> > A prior commit (commit f9a49aa302a0 ("fs/writeback: skip AS_NO_DATA_INTEGRITY
> > mappings in wait_sb_inodes()")) added the AS_NO_DATA_INTEGRITY mapping flag to
> > skip sync(2) waits for mappings without data integrity semantics, but it still
> > allowed wb_workfn() worker threads to be kicked off for the writeback.
> >
> > This patch improves upon that by replacing the per-inode AS_NO_DATA_INTEGRITY
> > mapping flag with a flag at the superblock level, and using that superblock
> > flag to skip the sync_inodes_sb() path entirely if there are no data integrity
> > guarantees. The flag belongs at the superblock level because data integrity is
> > a filesystem-wide property, not a per-inode one. Having the flag at the
> > superblock level allows sync_inodes_one_sb() to skip the entire filesystem
> > efficiently, rather than iterating every dirty inode only to skip each one
> > individually.
> >
> > This patch restores fuse to its prior behavior before tmp folios were removed,
> > where sync was essentially a no-op.
> >
> > [1] https://lore.kernel.org/linux-fsdevel/CAJnrk1a-asuvfrbKXbEwwDSctvemF+6zfhdnuzO65Pt8HsFSRw@mail.gmail.com/T/#m632c4648e9cafc4239299887109ebd880ac6c5c1
> >
> > Fixes: 0c58a97f919c ("fuse: remove tmp folio for writebacks and internal rb tree")
> > Reported-by: John <therealgraysky@proton.me>
> > Tested-by: John <therealgraysky@proton.me>
> > Cc: <stable@vger.kernel.org>
> > Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
>
> I'd note that previously, if the FUSE server was not broken, although
> sync(2) would not provide any data integrity guarantee, it would still
> flush the data so practically, there would be no user observable difference
> unless you really did powerfail testing. So some users might be
> unpleasantly surprised by sync(2) suddently not doing anything on FUSE
> filesystems. Maybe for SB_I_NO_DATA_INTEGRITY filesystems we should at
> least kick flush worker to do writeback in the background?
>
> Honza
>
That's a great point. I'll make this change for v2.
Thanks,
Joanne
prev parent reply other threads:[~2026-03-19 18:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-18 22:56 [PATCH v1] writeback: skip sync(2) inode writeback for filesystems with no data integrity guarantees Joanne Koong
2026-03-19 12:42 ` Jan Kara
2026-03-19 18:07 ` Joanne Koong [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJnrk1Z7OTah=zam8_4LWx8Kc0B6omrVbiiDRNHm34yAKNEBEA@mail.gmail.com' \
--to=joannelkoong@gmail.com \
--cc=brauner@kernel.org \
--cc=david@kernel.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=stable@vger.kernel.org \
--cc=therealgraysky@proton.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox