From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D602517BCB; Wed, 30 Sep 2026 16:08:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790784486; cv=none; b=d9KUOqZOH9kDJ7DuZOFYxsk3qhrhU4WCJl8Es5kX7Sww2UQhz2MrZuUIcirM+G0XJHeuyyZWRuh4w2HljLtu94nSqYlTNVhPLUey0PbRs5C1mNcOjGaKV9sFZCaw61lJ1b2XfZSlMj7GAsbCYOpFE4OsLh6gflFYhidAU3VCpk0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790784486; c=relaxed/simple; bh=b8OFyFtmV4YkyzK8x4IeXnH9IopNtLkx6bX4FqOU7bA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BfhrQGT4c4ch1667NVRyJIPgsfW/CvHx8WHTxhmdFwvgnWYeq7h02v5Pl16UCgrHWF1nJ1KOeGDWwFXl7K5pXnduJQXOGcAIX8gn/FrlOeVHLuXdEgjtUdQtX/REvg6Hly2WYDiUwTbpNtTFi7x5DlawiVTtJcL9v/KJ7Y31cMA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=vbwTfDsx; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="vbwTfDsx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A16EA1F000FF; Wed, 30 Sep 2026 16:08:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790784482; bh=8aj/Z+BffbbeYx5wtOZNE8DL3fZv9izwSr0vjtGjJps=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=vbwTfDsxQnN2ty/T2xSK0KfbO3QUSPNAipi4Nuee1JvntkBo+aQaSNNYQ59yvWm0n oyKnp4jLSF/wHmdRqbxBRUUjnyqDF2LcXCbxqmUejI0JUQlM0PxWY7yH/3K2U17jCD Rnc9atdki7Nt6guf77I+ZkI8RYQaWYLbU35GUrFo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dai Ngo , Anna Schumaker , Sasha Levin Subject: [PATCH 6.1 164/982] NFS: fix eof updates after NFSv4.2 fallocate/zero-range Date: Wed, 30 Sep 2026 17:15:00 +0200 Message-ID: <20260930152420.333433611@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152416.775402466@linuxfoundation.org> References: <20260930152416.775402466@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dai Ngo [ Upstream commit 35168eb947f230aaa35fd8416a30563ef89f5421 ] Generic/075 reliably exposes a regression when the client holds an NFSv4 write delegation: ZERO_RANGE/ALLOCATE extends the file on the server, but the local inode keeps the old i_size. The test then fails with 'Size error' because the post-op attribute refresh refuses to touch i_size while a delegation is outstanding, and the cached EOF was never marked stale. Update _nfs42_proc_fallocate() so that on success it: - bumps i_size when the operation extends the file, and - marks NFS_INO_INVALID_BLOCKS since the block count can also change Tested with xfstests generic/075 over NFSv4.2. Signed-off-by: Dai Ngo Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin --- fs/nfs/nfs42proc.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c index 923ccd3b540f5..ad0ab93c1bb04 100644 --- a/fs/nfs/nfs42proc.c +++ b/fs/nfs/nfs42proc.c @@ -79,12 +79,17 @@ static int _nfs42_proc_fallocate(struct rpc_message *msg, struct file *filep, status = nfs4_call_sync(server->client, server, msg, &args.seq_args, &res.seq_res, 0); if (status == 0) { - if (nfs_should_remove_suid(inode)) { - spin_lock(&inode->i_lock); + loff_t newsize = offset + len; + + spin_lock(&inode->i_lock); + if (newsize > i_size_read(inode)) + i_size_write(inode, newsize); + nfs_set_cache_invalid(inode, NFS_INO_INVALID_BLOCKS); + if (nfs_should_remove_suid(inode)) nfs_set_cache_invalid(inode, - NFS_INO_REVAL_FORCED | NFS_INO_INVALID_MODE); - spin_unlock(&inode->i_lock); - } + NFS_INO_REVAL_FORCED | + NFS_INO_INVALID_MODE); + spin_unlock(&inode->i_lock); status = nfs_post_op_update_inode_force_wcc(inode, res.falloc_fattr); } -- 2.53.0