Re: [PATCH v7 2/7] ovl: no fsync=relaxed without data integrity

From: Amir Goldstein

Date: Wed Nov 18 2026 - 13:00:31 EST


On Wed, Nov 18, 2026 at 6:03 PM Josef Bacik <josef@xxxxxxxxxxxxxx> wrote:
>
> A sync does not wait for a filesystem with SB_I_NO_DATA_INTEGRITY, which is
> fuse, so that a server that does not answer cannot block it.
>
> With fsync=relaxed, syncfs() and unmount of the overlay are going to write
> the upper inodes one by one and wait for each. fuse_write_inode() waits
> for the server whatever the sync mode is, so they would wait for the
> server once for every inode.
>
> Do not resolve fsync=auto to fsync=relaxed on such an upper filesystem, and
> fall back to fsync=on if fsync=relaxed was asked for.
>
> Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx>

Ha I very much didn't want to include FUSE in this exclusive club
This was an oversight on my part.

Reviewed-by: Amir Goldstein <amir73il@xxxxxxxxx>

> ---
> Documentation/filesystems/overlayfs.rst | 4 ++++
> fs/overlayfs/super.c | 13 ++++++++++++-
> 2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/filesystems/overlayfs.rst b/Documentation/filesystems/overlayfs.rst
> index 1a59500834a1..8a007fbc5257 100644
> --- a/Documentation/filesystems/overlayfs.rst
> +++ b/Documentation/filesystems/overlayfs.rst
> @@ -870,6 +870,10 @@ The default is "fsync=on" instead of "fsync=auto" with the module option
> "fsync_auto=N" or with the kernel config option
> CONFIG_OVERLAY_FS_FSYNC_AUTO=n.
>
> +An upper filesystem that cannot guarantee data persistence on sync (fuse)
> +does not get "fsync=relaxed". "fsync=auto" means "fsync=on" there, and
> +"fsync=relaxed" falls back to it.
> +
> If the upper filesystem has no writeback (e.g. tmpfs), a non-default mode
> falls back to "fsync=off".
>
> diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
> index 5960974c5af2..31a58e28968c 100644
> --- a/fs/overlayfs/super.c
> +++ b/fs/overlayfs/super.c
> @@ -765,7 +765,8 @@ static int ovl_make_workdir(struct super_block *sb, struct ovl_fs *ofs,
>
> /* fsync=auto that is not resolved to fsync=relaxed means fsync=on */
> if (ofs->config.fsync_mode == OVL_FSYNC_AUTO && rename_whiteout &&
> - mnt->mnt_sb->s_bdi != &noop_backing_dev_info)
> + mnt->mnt_sb->s_bdi != &noop_backing_dev_info &&
> + !(mnt->mnt_sb->s_iflags & SB_I_NO_DATA_INTEGRITY))
> ofs->config.fsync_mode = OVL_FSYNC_RELAXED;
>
> /*
> @@ -1499,6 +1500,16 @@ static int ovl_fill_super_creds(struct fs_context *fc, struct super_block *sb)
> ofs->config.fsync_mode = OVL_FSYNC_OFF;
> }
>
> + /*
> + * A sync does not wait for such an upper fs, whose server may
> + * not answer. A relaxed overlay waits for each upper inode.
> + */
> + if ((upper_sb->s_iflags & SB_I_NO_DATA_INTEGRITY) &&
> + ofs->config.fsync_mode == OVL_FSYNC_RELAXED) {
> + pr_warn("upper fs does not guarantee data integrity, falling back to fsync=on.\n");
> + ofs->config.fsync_mode = OVL_FSYNC_ON;
> + }
> +
> if (!ovl_should_sync(ofs)) {
> ofs->errseq = errseq_sample(&upper_sb->s_wb_err);
> if (errseq_check(&upper_sb->s_wb_err, ofs->errseq)) {
>
> --
> 2.55.0
>