Linux block layer
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Jan Kara <jack@suse.cz>, Christian Brauner <brauner@kernel.org>
Cc: linux-fsdevel@vger.kernel.org,
	Andreas Gruenbacher <agruenba@redhat.com>,
		gfs2@lists.linux.dev, Mike Marshall <hubcap@omnibond.com>,
	Martin Brandenburg	 <martin@omnibond.com>,
	devel@lists.orangefs.org, Dave Kleikamp <shaggy@kernel.org>,
	 jfs-discussion@lists.sourceforge.net,
	Carlos Maiolino <cem@kernel.org>,
	 linux-xfs@vger.kernel.org, David Howells <dhowells@redhat.com>,
	Marc Dionne <marc.dionne@auristor.com>,
	linux-afs@lists.infradead.org,
	Miklos Szeredi	 <miklos@szeredi.hu>,
	fuse-devel@lists.linux.dev, linux-block@vger.kernel.org,
	 Chuck Lever <cel@kernel.org>,
	linux-nfs@vger.kernel.org, Eric Biggers <ebiggers@kernel.org>,
	Jaegeuk Kim	 <jaegeuk@kernel.org>,
	linux-fscrypt@vger.kernel.org
Subject: Re: [PATCH 11/13] nfsd: Use inode_or_folios_dirty() for dirtiness check in wait_for_concurrent_writes()
Date: Fri, 13 Nov 2026 08:08:32 -0500	[thread overview]
Message-ID: <bda5f50707205ff7fa55120247fec46300d420ad.camel@kernel.org> (raw)
In-Reply-To: <20261113084700.739002-24-jack@suse.cz>

On Fri, 2026-11-13 at 09:47 +0100, Jan Kara wrote:
> The check for dirtiness in wait_for_concurrent_writes() is racy because
> I_DIRTY_PAGES flag can be temporarily cleared by
> __writeback_single_inode(). Use inode_or_folios_dirty() helper to avoid
> that. This also makes sure inode timestamps properly persisted when
> lazytime is enabled.
> 
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  fs/nfsd/vfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
> index 56c49b5bc5bb..a314ca39272f 100644
> --- a/fs/nfsd/vfs.c
> +++ b/fs/nfsd/vfs.c
> @@ -1249,7 +1249,7 @@ static int wait_for_concurrent_writes(struct file *file)
>  		dprintk("nfsd: write resume %d\n", task_pid_nr(current));
>  	}
>  
> -	if (inode_state_read_once(inode) & I_DIRTY) {
> +	if (inode_or_folios_dirty(inode)) {
>  		dprintk("nfsd: write sync %d\n", task_pid_nr(current));
>  		err = vfs_fsync(file, 0);
>  	}

Reviewed-by: Jeff Layton <jlayton@kernel.org>

  reply	other threads:[~2026-11-13 13:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13  8:47 [PATCH 0/13] fs: Various I_DIRTY_* state handling fixes Jan Kara
2026-11-13  8:47 ` [PATCH 01/13] bdev: Drop pointless loop from blkdev_flush_mapping() Jan Kara
2026-11-13  8:47 ` [PATCH 02/13] xfs: Drop pointless I_DIRTY_PAGES check in xfs_can_free_cowblocks() Jan Kara
2026-11-13  8:47 ` [PATCH 03/13] orangefs: Check PAGECACHE_TAG_DIRTY instead of I_DIRTY_PAGES inode state Jan Kara
2026-11-13  8:47 ` [PATCH 04/13] fs: Provide inode_is_dirty() helper Jan Kara
2026-11-13  8:47 ` [PATCH 05/13] jfs: Use inode_is_dirty() in jfs_fsync() Jan Kara
2026-11-13  8:47 ` [PATCH 06/13] gfs2: Avoid racy dirtiness check in gfs2_fsync() Jan Kara
2026-11-13  8:47 ` [PATCH 07/13] fuse: Use inode_is_dirty() check in fuse_evict_inode() Jan Kara
2026-11-13  8:47 ` [PATCH 08/13] fs: Provide inode_or_folios_dirty() helper Jan Kara
2026-11-13  8:47 ` [PATCH 09/13] gfs2: Fix dirtiness checks in gfs2_write_inode() and evict_linked_inode() Jan Kara
2026-11-13  8:47 ` [PATCH 10/13] afs: Use inode_or_folios_dirty() in afs_evict_inode() Jan Kara
2026-11-13  8:47 ` [PATCH 11/13] nfsd: Use inode_or_folios_dirty() for dirtiness check in wait_for_concurrent_writes() Jan Kara
2026-11-13 13:08   ` Jeff Layton [this message]
2026-11-13  8:47 ` [PATCH 12/13] fscrypt: Use inode_or_folios_dirty() instead of explicit state check Jan Kara
2026-11-13  8:47 ` [PATCH 13/13] fs: Use inode_or_folios_dirty() in __inode_lru_list_add() Jan Kara

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=bda5f50707205ff7fa55120247fec46300d420ad.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=agruenba@redhat.com \
    --cc=brauner@kernel.org \
    --cc=cel@kernel.org \
    --cc=cem@kernel.org \
    --cc=devel@lists.orangefs.org \
    --cc=dhowells@redhat.com \
    --cc=ebiggers@kernel.org \
    --cc=fuse-devel@lists.linux.dev \
    --cc=gfs2@lists.linux.dev \
    --cc=hubcap@omnibond.com \
    --cc=jack@suse.cz \
    --cc=jaegeuk@kernel.org \
    --cc=jfs-discussion@lists.sourceforge.net \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=marc.dionne@auristor.com \
    --cc=martin@omnibond.com \
    --cc=miklos@szeredi.hu \
    --cc=shaggy@kernel.org \
    /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