All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ding Feng <dingf3ng@gmail.com>
To: amir73il@gmail.com
Cc: Christian Brauner <brauner@kernel.org>,
	Miklos Szeredi <miklos@szeredi.hu>,
	Josef Bacik <josef@toxicpanda.com>,
	Pavel Tikhomirov <ptikhomirov@virtuozzo.com>,
	linux-unionfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Ding Feng <dingf3ng@gmail.com>
Subject: Re: ovl: sync_file_range() does nothing on overlayfs files
Date: Wed, 18 Nov 2026 19:32:41 +0800	[thread overview]
Message-ID: <20261118113241.29101-1-dingf3ng@gmail.com> (raw)
In-Reply-To: <CAOQ4uxg5baphOjo+_A=3nZBmFEmMV7KOiv_W=rjEVYV41eTEaA@mail.gmail.com>

Amir Goldstein wrote:
> Like this?
>
> Completely untested.

Thanks, Amir. I tested it on v7.4-rc3 (20eef29b7c84), where it applies
with an 8-line offset in mm/filemap.c.

Setup: arm64 defconfig in QEMU; overlayfs with lower and upper on one
ext4 disk; periodic writeback off (dirty_writeback_centisecs=0). Each
case writes 64 MiB (16384 pages) through the overlay and calls
sync_file_range(fd, 0, 0, flags). Dirty pages are read with cachestat()
on the upper file's ext4 path, before and after the call.

                                   before patch       with patch
  ext4 file, flags=7              16384 -> 0         16384 -> 0
  overlay new file, flags=7       16384 -> 16384     16384 -> 0
  overlay new file, flags=2       16384 -> 16384     16384 -> 0 (4096 under writeback)
  read-only fd opened before
  copy-up, written via another
  fd, flags=7                     16384 -> 16384     16384 -> 0

cachestat() on the overlay fd reported cache=0 dirty=0 before the patch
and cache=16384 dirty=16384 with it, in all three overlay cases. All
calls returned 0, and the kernel log showed no warnings.

Tested-by: Ding Feng <dingf3ng@gmail.com>

Two questions:

1. FUSE passthrough also keeps data in a backing file
(fs/fuse/passthrough.c) and already forwards ->fadvise(). Does it need
->f_real() too? I have not tested that.

2. In the copy-up case, sync_file_range() on a read-only fd can now
open the upper file and return that open's error. The man page lists
none of those codes. I assume that is acceptable, as a write would see
the same error, but I wanted to mention it.

Thanks,
Ding Feng

  reply	other threads:[~2026-11-18 11:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18  4:00 ovl: sync_file_range() does nothing on overlayfs files Ding Feng
2026-11-18 10:16 ` Christian Brauner
2026-11-18 10:37   ` Amir Goldstein
2026-11-18 11:32     ` Ding Feng [this message]
2026-11-18 12:18       ` Amir Goldstein
2026-11-20 14:02         ` Christian Brauner

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=20261118113241.29101-1-dingf3ng@gmail.com \
    --to=dingf3ng@gmail.com \
    --cc=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=josef@toxicpanda.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=ptikhomirov@virtuozzo.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.