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. Reviewed-by: Jeff Layton Acked-by: Chuck Lever Signed-off-by: Jan Kara --- 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); } -- 2.53.0