]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
NFSv4.2: Serialise O_DIRECT i/o and fallocate()
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Fri, 5 Sep 2025 16:11:17 +0000 (12:11 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Sat, 6 Sep 2025 20:51:25 +0000 (16:51 -0400)
Ensure that all O_DIRECT reads and writes complete before calling
fallocate so that we don't race w.r.t. attribute updates.

Fixes: 99f237832243 ("NFSv4.2: Always flush out writes in nfs42_proc_fallocate()")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/nfs42proc.c

index e2fea37c53484b631c1d8cafb299ab001205bbfa..1a169372ca16e1ba49b77a738d4a169d959bb6e0 100644 (file)
@@ -114,6 +114,7 @@ static int nfs42_proc_fallocate(struct rpc_message *msg, struct file *filep,
        exception.inode = inode;
        exception.state = lock->open_context->state;
 
+       nfs_file_block_o_direct(NFS_I(inode));
        err = nfs_sync_inode(inode);
        if (err)
                goto out;