From nobody Mon Oct 6 01:26:48 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 BF42D28641F; Sat, 26 Jul 2025 14:32:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753540323; cv=none; b=mp09gkPodKPQdPDinvDKpfP+il6N9/NgaA9v81sgiQ+2xLoHsJq3Ms6+DqEgAf1giqdL2HjWA7+AU4cXyWyRWXNj0et2zkPrLluJPuUv8jkzwRJVkBfs1lgROg/JNAOU2GwI8JX2VDndvb7YQvtxOQoIOBOx8psbeU/boOmpmZk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753540323; c=relaxed/simple; bh=aP036MEInZMizMlEkvsGvCO+OnhGglaFKY/Y/gbmCZE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=l+TTw5/os2drPKlWEsPSPYb5SOVXRmtleOwJUQQCnsu94IjmU6a/MHf7ETOWcm8DQeNZ+115xLQ5Bxv8A/NQlLzBH1l3OdwiYPTZS5p4W0PJi/6j5qNuvDlDIK9/wy+Ya0JEW298FJDQ/lH7R8MIpws60tWUrx/BxMjEboxgAxI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QFYr4FLw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QFYr4FLw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5991C4CEF4; Sat, 26 Jul 2025 14:32:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753540323; bh=aP036MEInZMizMlEkvsGvCO+OnhGglaFKY/Y/gbmCZE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=QFYr4FLw3bKohdGu4z0asjzB4xpQSnIQgnlDvtkbIIh4kX5m/KKwmPO48YC0TJKYf JvYTJTKoptlrW/E96WvQ8rdMklfYdtoV+zMWYhK+5JfE+GZ7ZLWhDwlb1UmqlDL3D5 /5W2e5oux4FiYUgcOMX2hMKYNhS/gErkFUZTyNxALus4YZBUGaiNLV4BjHgzjlyimq wlpt0I/QVX2MwxLIKk2E10f+6vngx5K3vKO/IAjb+dODCqEAHZHhrMeDpPvf83R1Tl QsVIsgowvrYdwcpTRKpSQIEJYyevhViC8BWfN+IMAo/IgBtjwEdeY53jaXSOgSu8O4 fQVfEr4WAlaEA== From: Jeff Layton Date: Sat, 26 Jul 2025 10:31:55 -0400 Subject: [PATCH v2 1/7] vfs: add ATTR_CTIME_SET flag Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250726-nfsd-testing-v2-1-f45923db2fbb@kernel.org> References: <20250726-nfsd-testing-v2-0-f45923db2fbb@kernel.org> In-Reply-To: <20250726-nfsd-testing-v2-0-f45923db2fbb@kernel.org> To: Alexander Viro , Christian Brauner , Jan Kara , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Chuck Lever , NeilBrown , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: Trond Myklebust , Anna Schumaker , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, Jeff Layton X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2144; i=jlayton@kernel.org; h=from:subject:message-id; bh=aP036MEInZMizMlEkvsGvCO+OnhGglaFKY/Y/gbmCZE=; b=owEBbAKT/ZANAwAKAQAOaEEZVoIVAcsmYgBohObf3Ua9aEkOOtAl23noP5O10AxVC+aOHQJZ6 4Cld9XGRnKJAjIEAAEKAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCaITm3wAKCRAADmhBGVaC FaZHD/j9Bqt9Pq69NbRYG/7x7ZLTE/r6zIE+2w03+oeGO/1f7g6+/1SQ0N6G5Yx4H6iyd4fUtqw DzFdbwL+WjJhp7hSVjTxrcqfGmSLwFGqCgNnQnkbYMovmz+UDs48Xh4exek4RsVjK1V0Y29O72a cjD49Pe/ossqEIhwyYIlmlsElsg7mkw/L7j8FjqaWTTUkUsd8bJQMm6QgUwCUUKaKXWF32syomz O/q9/FwtPVEZBFbhketQrkYJoNlqd/mvmB/4BnqOtGADIo172swUb+v1Qc9q3W9ihjXvbaRFu7T o3O0r7E+EvbxDXA/8yfeJqLwzv4swYu69Ej/zbfyX4CM8raMyu/LjnHSJa0LcCIstEy+BRy1gdV c2ZFkgFZuJZHVATnO81/2LR1iQGKcIeBfml1YHgRMNdQUwAq/2+GT9IdT8RBUVSf9E+DXNSBs3s hnEKkLKja0v8/kEc3g2MP2jmjaXUcR0okrjRqbcaUDcncsLxjd78GMFzGHNQCytPWV/JlhhgCaZ Qx38v3j+Cu1glB/SdPEs2yM9YXsBEVXUGudKLW2d6Bpx7XMx8AM6GkNNi10Q0/+mw3eFH6sK0fN 8y0O3RuhdkoOe/RHTZhLRAh+BglNtfl1+bbhF9p08D1gzcVzrBAr1JYus2aCRNLfTpzfVrm9Cpi oiZAlzvK948P3 X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 When ATTR_ATIME_SET and ATTR_MTIME_SET are set in the ia_valid mask, the notify_change() logic takes that to mean that the request should set those values explicitly, and not override them with "now". With the advent of delegated timestamps, similar functionality is needed for the ctime. Add a ATTR_CTIME_SET flag, and use that to indicate that the ctime should be accepted as-is. Also, clean up the if statements to eliminate the extra negatives. Signed-off-by: Jeff Layton --- fs/attr.c | 15 +++++++++------ include/linux/fs.h | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/fs/attr.c b/fs/attr.c index 9caf63d20d03e86c535e9c8c91d49c2a34d34b7a..f0dabd2985989d283a931536a5f= c53eda366b373 100644 --- a/fs/attr.c +++ b/fs/attr.c @@ -463,15 +463,18 @@ int notify_change(struct mnt_idmap *idmap, struct den= try *dentry, =20 now =3D current_time(inode); =20 - attr->ia_ctime =3D now; - if (!(ia_valid & ATTR_ATIME_SET)) - attr->ia_atime =3D now; - else + if (ia_valid & ATTR_ATIME_SET) attr->ia_atime =3D timestamp_truncate(attr->ia_atime, inode); - if (!(ia_valid & ATTR_MTIME_SET)) - attr->ia_mtime =3D now; else + attr->ia_atime =3D now; + if (ia_valid & ATTR_CTIME_SET) + attr->ia_ctime =3D timestamp_truncate(attr->ia_ctime, inode); + else + attr->ia_ctime =3D now; + if (ia_valid & ATTR_MTIME_SET) attr->ia_mtime =3D timestamp_truncate(attr->ia_mtime, inode); + else + attr->ia_mtime =3D now; =20 if (ia_valid & ATTR_KILL_PRIV) { error =3D security_inode_need_killpriv(dentry); diff --git a/include/linux/fs.h b/include/linux/fs.h index 040c0036320fdf87a2379d494ab408a7991875bd..f18f45e88545c39716b917b1378= fb7248367b41d 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -237,6 +237,7 @@ typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t o= ffset, #define ATTR_ATIME_SET (1 << 7) #define ATTR_MTIME_SET (1 << 8) #define ATTR_FORCE (1 << 9) /* Not a change, but a change it */ +#define ATTR_CTIME_SET (1 << 10) #define ATTR_KILL_SUID (1 << 11) #define ATTR_KILL_SGID (1 << 12) #define ATTR_FILE (1 << 13) --=20 2.50.1 From nobody Mon Oct 6 01:26:48 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 3DCA32874E1; Sat, 26 Jul 2025 14:32:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753540326; cv=none; b=d1U0jVx6eHufaw13V1WSiGa/1efKpv7A41JYFoG4ep40691fPoonaYg00DAgcBaV4eNfu19nWfeXyoCFzhwio9Epozdc8fLe0HuMKbH00n/dPfbLV9vZOBVztwEZb5TSnZ+4kfvOv3kujvSIf+kJMv5UFwCjycCTwaHT1kR+Uhc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753540326; c=relaxed/simple; bh=HlUFhtJZ0QZjUdN5XDHoZHQfPM0ewGEXkaJbOvSrW3A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BhB3MxnD4b+Ln0lh/zBTsjpc1utm6QnB62glXmxDezkX4C9yYQj81rgyDpdiFPTdWj7Ck64aTzrlbFPRdOUGTSHydLFv1wSZjQ2y+4EPgiVBYvU0Iye0qbbPUA1Dv3wT6weV+X8Mei/Tx4KvDRm3vAdpUuZyH4Zc8R6N9NX8hVc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ODELNqKz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ODELNqKz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75D59C4CEF7; Sat, 26 Jul 2025 14:32:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753540324; bh=HlUFhtJZ0QZjUdN5XDHoZHQfPM0ewGEXkaJbOvSrW3A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ODELNqKzDv4k18PmhxMnuftK9xVutbUYjL+l0rZsov53lPkqFsnogy0ceQTQIFIer mDqSuZEEpI6cmK2bf2yU3fHP3MOrfygfs/cwHtTKEcF6O5+wR1hzO0KxKPTEp18H6F 9Uq3cFPmYZGuxUrBW1SoDGzOTmHxuLyDySPrAe/iwGZAdESOD7gc7OZcn+gpQSB9Uh fcOv9McqoUnYF7llzgKYqKpW31Xc/QzyF0sq74e7CKa7jkBsIWKvfBEoKenJgrqGOr ETB/1UIei9kD0Yho9olap2W/IAMUzc6JkpRofInwJn5PAmBj1/Wmob7xYFLIwoWGwA 7cyt1Zn+nD+0w== From: Jeff Layton Date: Sat, 26 Jul 2025 10:31:56 -0400 Subject: [PATCH v2 2/7] nfsd: ignore ATTR_DELEG when checking ia_valid before notify_change() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250726-nfsd-testing-v2-2-f45923db2fbb@kernel.org> References: <20250726-nfsd-testing-v2-0-f45923db2fbb@kernel.org> In-Reply-To: <20250726-nfsd-testing-v2-0-f45923db2fbb@kernel.org> To: Alexander Viro , Christian Brauner , Jan Kara , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Chuck Lever , NeilBrown , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: Trond Myklebust , Anna Schumaker , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, Jeff Layton X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=605; i=jlayton@kernel.org; h=from:subject:message-id; bh=HlUFhtJZ0QZjUdN5XDHoZHQfPM0ewGEXkaJbOvSrW3A=; b=owEBbQKS/ZANAwAKAQAOaEEZVoIVAcsmYgBohObftY4nPoGSZnyvzLMt13ECsvcxlNPD07/B+ +RFdhXKunCJAjMEAAEKAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCaITm3wAKCRAADmhBGVaC Fb9wD/9UZ8o3InKxb78teIh7hrZuyp+dJ4JGBxt0e6Ca5TCxQflbGRfeZ+izCLpjNSC+Wd8yD8f mrk0oYz5cwB/p4jnbbBQE1LOr5uhDc5D9fnd1O054eH9Hnoxfxhwqq1xMe5NrZi+qnTfdXlenTx /sjoSA2IVijDS+J0WMAkKge4qd9yjDIGzO/aDdvOravjK0H7XHLYex120/PHRHF7jgDvVlXhQfn HsO99pfRIv3K4Xrp5IVHo9HbL+7BihKEzJH93wb6bkfels6ru9lqk4qcjYKXjl34lw+cBTylWqW I7pVAylpflrQCfVtIx34hCBJa6qaEPpRJ/jalTfcBc0sFakYNO2pfNJbx8zoBToMWgn4zwF00zF mz56uMQCMB/BU14MpDhBnPgLhX71MkxAPf0t5F8uAH3WXrtk66TQtjmFVxc9KZ7/spx7qZojU0t +a/8wp42HWsGy4Ljw3o1wZXZAgUvw76kHeSe3XT9d8LUoZ1l3JGaIFDLZaQSTYaLE44plyyO2X/ O8b1ry/7dMpnPFoVILkumoNx09yt1MuaHG5naKSXhtryJsWAE8Cv1Wj3kvGqlb7KtFT6gsf8A+K chKlTKaZ+n2mWXaoYx2uX2bIPodlXo9IZsKA2NxgXblMsrhVBy33yjZNkprq+EJvpmR21yFacmm GghTSrVgGe1R6vQ== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 If the only flag left is ATTR_DELEG, then there are no changes to be made. Signed-off-by: Jeff Layton --- 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 eaf04751d07fe9be4d1dd08477bc5a38ac99be3a..68d42fc5504d8750174b9a2aef1= 0886ed92f528b 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -467,7 +467,7 @@ static int __nfsd_setattr(struct dentry *dentry, struct= iattr *iap) return 0; } =20 - if (!iap->ia_valid) + if ((iap->ia_valid & ~ATTR_DELEG) =3D=3D 0) return 0; =20 /* --=20 2.50.1 From nobody Mon Oct 6 01:26:48 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D0DC42877E0; Sat, 26 Jul 2025 14:32:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753540327; cv=none; b=MuIkj9JdCwemd5AmMiZyQu2b0T/ozAlzAKxodIXhkgXto4wx0rFjVH0aolmd2wpOb8VN/uUWFq+3teTU50ltweO9ZwiCog4Z3klxyiFLCHogP0p1igH2Q7uzqnH4E0y0L+VL/B4IjuRetWJWI8oe/Mjumya/DQO8Dd7HmdCerPA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753540327; c=relaxed/simple; bh=r7yx7kdAf9pxTUof3VEIKP4LhrLVZ9kWufEdB0iUHls=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=biFkwKzyXzLsEapc1FWGjkGXt1HzwLdgoac4LEOcwcAR9e0oCE56c4QPHMviEt434P+gtz5gypm5IHkGNXDG+xpvYTgMZSLfzTFNkAXVrKCRLW02ch+CkSw6qKBYlq+f5PUoaEOVQyobC5lWXkAvLIF/LrtHlgoQKUaOtiGWLnE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eYAhKQfY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eYAhKQfY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16915C4CEED; Sat, 26 Jul 2025 14:32:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753540326; bh=r7yx7kdAf9pxTUof3VEIKP4LhrLVZ9kWufEdB0iUHls=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=eYAhKQfYLaWJJIW2vTgjBAxhpvSohOab1gorflzrwg1bpCMOVC5BB4ieC5Eqku7/M /hthPwbcyccbfWdRmxX1baPIMIPGkIeMnoIdfpSLymwXKWf53kO8GEuaegmis1GFFl 9c468wlPH7YzUNOA86xgVZR1NJcLsC7t00hU5lWcxj/8V880JM1Icg2/EI2inPHDmq t/9g5SuIf+PmOTeyUa3Wbp25KO7mxoxE41tNUit0SVQ0lvBaZk7iIUFrIyG8ghJ2ge WAnN6Ur/7Q91FgNsJ/Kiai1UI4C6EwyjeUWQeC7dEQvnFFTN6l8b/fvog9j3/kCzPU 62RLlN/wA9gNg== From: Jeff Layton Date: Sat, 26 Jul 2025 10:31:57 -0400 Subject: [PATCH v2 3/7] nfsd: use ATTR_CTIME_SET for delegated ctime updates Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250726-nfsd-testing-v2-3-f45923db2fbb@kernel.org> References: <20250726-nfsd-testing-v2-0-f45923db2fbb@kernel.org> In-Reply-To: <20250726-nfsd-testing-v2-0-f45923db2fbb@kernel.org> To: Alexander Viro , Christian Brauner , Jan Kara , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Chuck Lever , NeilBrown , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: Trond Myklebust , Anna Schumaker , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, Jeff Layton X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2843; i=jlayton@kernel.org; h=from:subject:message-id; bh=r7yx7kdAf9pxTUof3VEIKP4LhrLVZ9kWufEdB0iUHls=; b=owEBbQKS/ZANAwAKAQAOaEEZVoIVAcsmYgBohObf2Vk5RtZz829UGIYhS4geaSIcO/cmG2btM xMG2I4f7baJAjMEAAEKAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCaITm3wAKCRAADmhBGVaC FUpnD/sFt5m266+0u4xYacBrHpiT5Hm9BthrTmud/ZVyyRA45+v5LCTiQqSc1mWZD10AP5GzcLA rjQI99t78z/Ilnc9g0Px0iX1wdWr8xtwSkCJK4+/xqRdrF48Br/2k+NDkgMfas+ogVuNA1tFeas p30m+LxyvFelYRX47vbhjELBtxskRiFDRNZYk5UwyZu9UoSV/g3BpKEqhIkPB8WUhtmFJMbUE2T wxHoj+DBtWw5LA3fm0KgxJUwqBjEH4onJLtKqlOSBa1sU5anvy2ole4Ykpfcw7YgIJbzKj2wUHK QB91lxbZnMC1L//+hZ5cUNwUTps2nMgoR/UugYst2+hE8WDGfkn+AFcWVAl+6ZEL5ibwlk4937b O9HD/LbUFZNe47bw6VtYsEHBZMYuvXAwluz2a4NaDJ/8DX/oBw7fqJ6tFoYQ+7wSQT9svPIbs9o hM556QM3PGLK1siMTnnMDQobBQz3Ws2cGhMnGd3hGIpFNZPUJjX4PGEDI8Q47IcpLUEjQt7PEvY WvW1KSjhB2FdDs/7PMPTs7X5bXM9JLpUkPvhJ4ThFkvKuaC09hxa2HtEn2NVDc+65NYKj1t3sSq Yz6nJTiUWusl71fjmI4Izc7Mzh/VZH76fcth9Ruu3ueeANzz+PqZuTkJi20gZo7/PV6jE4l+jYM KQqMVurViy6SXgA== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 Ensure that notify_change() doesn't clobber a delegated ctime update with current_time() by setting ATTR_CTIME_SET for those updates. Also, set the tv_nsec field the nfsd4_decode_fattr4 to the correct value. Don't bother setting the timestamps in cb_getattr_update_times() in the non-delegated case. notify_change() will do that itself. Signed-off-by: Jeff Layton --- fs/nfsd/nfs4state.c | 6 +++--- fs/nfsd/nfs4xdr.c | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 88c347957da5b8f352be63f84f207d2225f81cb9..77eea2ad93cc07939f045fc4b98= 3b1ac00d068b8 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -9167,7 +9167,6 @@ static bool set_cb_time(struct timespec64 *cb, const = struct timespec64 *orig, static int cb_getattr_update_times(struct dentry *dentry, struct nfs4_dele= gation *dp) { struct inode *inode =3D d_inode(dentry); - struct timespec64 now =3D current_time(inode); struct nfs4_cb_fattr *ncf =3D &dp->dl_cb_fattr; struct iattr attrs =3D { }; int ret; @@ -9175,6 +9174,7 @@ static int cb_getattr_update_times(struct dentry *den= try, struct nfs4_delegation if (deleg_attrs_deleg(dp->dl_type)) { struct timespec64 atime =3D inode_get_atime(inode); struct timespec64 mtime =3D inode_get_mtime(inode); + struct timespec64 now =3D current_time(inode); =20 attrs.ia_atime =3D ncf->ncf_cb_atime; attrs.ia_mtime =3D ncf->ncf_cb_mtime; @@ -9183,12 +9183,12 @@ static int cb_getattr_update_times(struct dentry *d= entry, struct nfs4_delegation attrs.ia_valid |=3D ATTR_ATIME | ATTR_ATIME_SET; =20 if (set_cb_time(&attrs.ia_mtime, &mtime, &now)) { - attrs.ia_valid |=3D ATTR_CTIME | ATTR_MTIME | ATTR_MTIME_SET; + attrs.ia_valid |=3D ATTR_CTIME | ATTR_CTIME_SET | + ATTR_MTIME | ATTR_MTIME_SET; attrs.ia_ctime =3D attrs.ia_mtime; } } else { attrs.ia_valid |=3D ATTR_MTIME | ATTR_CTIME; - attrs.ia_mtime =3D attrs.ia_ctime =3D now; } =20 if (!attrs.ia_valid) diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 8b68f74a8cf08c6aa1305a2a3093467656085e4a..c0a3c6a7c8bb70d62940115c310= 1e9f897401456 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -538,8 +538,9 @@ nfsd4_decode_fattr4(struct nfsd4_compoundargs *argp, u3= 2 *bmval, u32 bmlen, iattr->ia_mtime.tv_sec =3D modify.seconds; iattr->ia_mtime.tv_nsec =3D modify.nseconds; iattr->ia_ctime.tv_sec =3D modify.seconds; - iattr->ia_ctime.tv_nsec =3D modify.seconds; - iattr->ia_valid |=3D ATTR_CTIME | ATTR_MTIME | ATTR_MTIME_SET | ATTR_DEL= EG; + iattr->ia_ctime.tv_nsec =3D modify.nseconds; + iattr->ia_valid |=3D ATTR_CTIME | ATTR_CTIME_SET | + ATTR_MTIME | ATTR_MTIME_SET | ATTR_DELEG; } =20 /* request sanity: did attrlist4 contain the expected number of words? */ --=20 2.50.1 From nobody Mon Oct 6 01:26:48 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 388B41F418B; Sat, 26 Jul 2025 14:32:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753540328; cv=none; b=loVldVk4NKJyXOYqWChe2h16WBVndsh1rKlchcB6Ub4r6xo/QVPd2AWtMWRhQmS0+UlhVC7O7iZhzVs+Da0pJLtjeT/mRy6Z6JKMOSHILDm55dmc2Z+A5i6UOw6I0ZdEd2LUtkIW5NMmPPbd09QhtRtOaluj/YcwCXKhKPt/Mfc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753540328; c=relaxed/simple; bh=mllCwPj6DFXflnCokynS72iAnT7y1fHTRFT6HF/wY0M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CFjGQNe6eLFq5mFqSVdjoyuvXRPLNXQ/n91Q1KNZOoA7c2OerebUXglJrrYR9OVGjEGFJ3kaYZUFfLKcthMERdfd+84r/SySFH5lGw+MOt+zTlJMFcSO5j3rP3vZ71aLfYDUVDOgGK40ikLZI+EyUvJe2k4NFoEg3Mq7iMiyXlA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LTSIijLe; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LTSIijLe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA618C4CEF4; Sat, 26 Jul 2025 14:32:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753540328; bh=mllCwPj6DFXflnCokynS72iAnT7y1fHTRFT6HF/wY0M=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=LTSIijLeO2ZDLhdXgiZFrgZQ4hcgtEAOdzXWlw/gtaet6h4mJXIv4i3t5fw4G5tmn ukpTvXrNwekHCew8iXNovOsLH9bdyHD5joVfSWYLEy8vb1pC2cpWrBTQa7CM/P1DzW v+qohV36AE3DSL7JGfSNg8lY8TuXQU3/9lH6vI9FRtkeanrhn91lKWtYJP6Mgbu88Q pJxXVKiVC/2WpFwEL5dTdY544sQa/sosow0y2+dLDqMU/YTKr0WaheROW/jXe6SbE4 B83okeL2Hi7weFyMQ0znk5EtZgG2b+8vmjnm9PTb7kTKWGSt/YFgFQITaQuuld2q3e +65yQspdkDyqQ== From: Jeff Layton Date: Sat, 26 Jul 2025 10:31:58 -0400 Subject: [PATCH v2 4/7] nfsd: track original timestamps in nfs4_delegation Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250726-nfsd-testing-v2-4-f45923db2fbb@kernel.org> References: <20250726-nfsd-testing-v2-0-f45923db2fbb@kernel.org> In-Reply-To: <20250726-nfsd-testing-v2-0-f45923db2fbb@kernel.org> To: Alexander Viro , Christian Brauner , Jan Kara , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Chuck Lever , NeilBrown , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: Trond Myklebust , Anna Schumaker , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, Jeff Layton X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2735; i=jlayton@kernel.org; h=from:subject:message-id; bh=mllCwPj6DFXflnCokynS72iAnT7y1fHTRFT6HF/wY0M=; b=owEBbQKS/ZANAwAKAQAOaEEZVoIVAcsmYgBohObf5vYf6eHZexpl2tdgIQBRlhYg5k/CB7zNS Qtqf2Is2GeJAjMEAAEKAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCaITm3wAKCRAADmhBGVaC FVHlD/4wEeSisUzy2cOJj2eHQFitOxNZ75zC68DqX51dQ+tSYIBTR5KzX1xQkQ6WWVGk6lJ5AXx gU1v09XrwREoMzDkIJIK9FDDFigovYpsWId4uqUq13sKj1jtOTMg97CEyYXXZ4ZBy26YHVHdtaO ib2eJKtMk9yIr4llGv/EOhi9gio/fugeYBkPtszvt0iYl9frauW4p04Qud1F9g4XEjiANyHb/ny cF5dkxfNDdrcNH+vxSA5fNYXGRHDhzfHBGTVjxBE69+1Pl6e3NrGMZtLDD3hEIUNKFxrGixDN/J RWOtmw86mi/PAYQLO4W6aXYVuC/l/8i5A//xOkvWMdTzboVkkMGM7Ew5ObFTqxKd3BnpoaU7IYe TpEPirrNOGZCTFb7sHNfwSGEyuF4IV+hdzyU24pfPA0tZDhS2j9wqh3JZxpsSHmspdm2KdK/qo2 V6qO1w40uSN7jqY7YZPYZcqTMdhNHs3n23FFAtUNhpsxCwZ6o8lvrbQUW1gOPHb/oWO5PLbeMFd SnhePojyUi2iKKRHs4tYRqWtBOnV3GdosOF28al3Thnb9UvfOwBtBwIwPjQ7lNfxWG2L/R36BU6 eHvImRvXEAzTgOOBsD8Mb3MbPoQjkJC6pHTgAUcSEl7Q5jUnQcfd/VjRPWx8a707A6RtIDvgP30 GXAX50ClADOWB9g== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 As Trond points out [1], the "original time" mentioned in RFC 9754 refers to the timestamps on the files at the time that the delegation was granted, and not the current timestamp of the file on the server. Store the current timestamps for the file in the nfs4_delegation when granting one. Add STATX_ATIME and STATX_MTIME to the request mask in nfs4_delegation_stat(). When granting OPEN_DELEGATE_READ_ATTRS_DELEG, do a nfs4_delegation_stat() and save the correct atime. If the stat() fails for any reason, fall back to granting a normal read deleg. [1]: https://lore.kernel.org/linux-nfs/47a4e40310e797f21b5137e847b06bb203d9= 9e66.camel@kernel.org/ Signed-off-by: Jeff Layton --- fs/nfsd/nfs4state.c | 11 ++++++++--- fs/nfsd/state.h | 5 +++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 77eea2ad93cc07939f045fc4b983b1ac00d068b8..8737b721daf3433bab46065e751= 175a4dcdd1c89 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -6157,7 +6157,8 @@ nfs4_delegation_stat(struct nfs4_delegation *dp, stru= ct svc_fh *currentfh, path.dentry =3D file_dentry(nf->nf_file); =20 rc =3D vfs_getattr(&path, stat, - (STATX_MODE | STATX_SIZE | STATX_CTIME | STATX_CHANGE_COOKIE), + STATX_MODE | STATX_SIZE | STATX_ATIME | + STATX_MTIME | STATX_CTIME | STATX_CHANGE_COOKIE, AT_STATX_SYNC_AS_STAT); =20 nfsd_file_put(nf); @@ -6274,10 +6275,14 @@ nfs4_open_delegation(struct svc_rqst *rqstp, struct= nfsd4_open *open, OPEN_DELEGATE_WRITE; dp->dl_cb_fattr.ncf_cur_fsize =3D stat.size; dp->dl_cb_fattr.ncf_initial_cinfo =3D nfsd4_change_attribute(&stat); + dp->dl_atime =3D stat.atime; + dp->dl_ctime =3D stat.ctime; + dp->dl_mtime =3D stat.mtime; trace_nfsd_deleg_write(&dp->dl_stid.sc_stateid); } else { - open->op_delegate_type =3D deleg_ts ? OPEN_DELEGATE_READ_ATTRS_DELEG : - OPEN_DELEGATE_READ; + open->op_delegate_type =3D deleg_ts && nfs4_delegation_stat(dp, currentf= h, &stat) ? + OPEN_DELEGATE_READ_ATTRS_DELEG : OPEN_DELEGATE_READ; + dp->dl_atime =3D stat.atime; trace_nfsd_deleg_read(&dp->dl_stid.sc_stateid); } nfs4_put_stid(&dp->dl_stid); diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index 8adc2550129e67a4e6646395fa2811e1c2acb98e..ce7c0d129ba338e1269ed163266= e1ee192cd02c5 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h @@ -224,6 +224,11 @@ struct nfs4_delegation { =20 /* for CB_GETATTR */ struct nfs4_cb_fattr dl_cb_fattr; + + /* For delegated timestamps */ + struct timespec64 dl_atime; + struct timespec64 dl_mtime; + struct timespec64 dl_ctime; }; =20 static inline bool deleg_is_read(u32 dl_type) --=20 2.50.1 From nobody Mon Oct 6 01:26:48 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C2561288C15; Sat, 26 Jul 2025 14:32:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753540329; cv=none; b=PwO902WYw8qVrRxyzCAXXpFDoBzGY8qxZV2yYv68dGDBe8zpv2jNaANwLJO6f4umjnzFTLFrutq6JEmituBWmCOKZ4bmHT6EhP/eMkDFHagpFwaON7UFAGdNOfEYKRG5PntPVzA3Lh+KG1RdgjFftNjC1ZOhtSKPxvz4CKX790w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753540329; c=relaxed/simple; bh=sVxn+5YLRgFl9kXsoyZz5Ry1Ns26Txub2C7tzgdd+Og=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=H+ZgqLPg44xpFWrlWIUHOXvrWh3qJNl11BsF5zn4hxGz/tyHtGw8Qr4R5gD2TDeqPSWOH7ZGTR9fmL2jKQhMQS47mO/hIUkdd3HYse0LFUnD6wb5fqcP4ACs1ye/7sXpR4x8/Nfa7z2R7H+yP+eiJgvDMGNkMjxL5QM7JWNnnr8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SNnsL0Tw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SNnsL0Tw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 497E6C4CEED; Sat, 26 Jul 2025 14:32:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753540329; bh=sVxn+5YLRgFl9kXsoyZz5Ry1Ns26Txub2C7tzgdd+Og=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=SNnsL0TwbBGEPlKgHdNMBcTpQokBhIggVLv6rW0mNk4OAMD/6FoKOBzU3dqUn2FJ8 eaVnlhBaRz0uTfJPVzorI1yw3ux1FzR+LNzedtqSk6JSk6M98DmRlruObTA+thcOIV MvtldWdCQFhXdCe6Q1kyZ/AcoZOMC0eVM9Us2do9wyRzFjhcMn4aMSztrrbTa3K8E1 qxxmX0Npjl4ooA4V94alwureZAXB2ed+tx6OxvV2bvTxfp1Vg8M2dMiMdHskbb3YXM V2U1K68JfM0MDuF7r9xYbhm95eV93VLubkQmfhll5UGF6C58RZoX543oe99/UeAiR+ HfqzSi7j1KH3A== From: Jeff Layton Date: Sat, 26 Jul 2025 10:31:59 -0400 Subject: [PATCH v2 5/7] nfsd: fix SETATTR updates for delegated timestamps Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250726-nfsd-testing-v2-5-f45923db2fbb@kernel.org> References: <20250726-nfsd-testing-v2-0-f45923db2fbb@kernel.org> In-Reply-To: <20250726-nfsd-testing-v2-0-f45923db2fbb@kernel.org> To: Alexander Viro , Christian Brauner , Jan Kara , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Chuck Lever , NeilBrown , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: Trond Myklebust , Anna Schumaker , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, Jeff Layton X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5765; i=jlayton@kernel.org; h=from:subject:message-id; bh=sVxn+5YLRgFl9kXsoyZz5Ry1Ns26Txub2C7tzgdd+Og=; b=owEBbQKS/ZANAwAKAQAOaEEZVoIVAcsmYgBohObfiwi1TkiOKs9YP4lEA79kqJ1CEIgvjvg75 umSP9x4Cg6JAjMEAAEKAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCaITm3wAKCRAADmhBGVaC FcuED/4mzsJ581iSO5kNrYFAQ5mX8fxvSRNBqJFSZC1sz/kIDjCoplJkS3CH5CEm968ToV862B9 YV8wrcePNWWm32BV4c7NGwtZmbtVM7N09hWDYp884KBdfMDL+B5CaEkZGCs674IKh+Q6KYIc4HX f2kkjcEHaorxIlw7xDRd1xSfqMG4+Ak/wrPAsJmaH2XNADJytSRHpYkbqjYlaThIEdL/Mb9eaCE wLjcOPWMHoEitUXdr14434W1k09jB7e+7m/D5d7O+vaNFoeCjdS/pCrHOYxgaU1GQ7wMV7YB72P LO7cs7TIhry2yEm2VPGBn78BxM5erd5lW23EoJQdKVSr9zPm2wNNUuFeWRmwlskO9TgDP9Piq7e SH0fuMZeoVDNP0Mv9h3DpVhIUDPpUhDyt1DNBRkOWQMHUR7lflOs6N3zfIdOm4EvQ48U1yGjTUE oN4ZO8GGE9uNrfGsQ9lz0sIonPd+asujWtnab2p/mfqvzjMR3x7GKFCm6vwFNoohn1NYrohgvKF SxWVD7taGDE5ya1HMRDgh/tNhCFnA7HcCAFKPLwGe7j4DJMSIMJ1aYzxUCIGbNGtyKmpAOPWR9S hMpUYpELa+K1iUcF+BilbtdmIra5Xf3x+uLMpTbModz+Y0sYSf7fs3H+2SIXKn3AvxfMK7wPPya arm3jRfHLuxll0g== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 SETATTRs containing delegated timestamp updates are currently not being vetted properly. Since we no longer need to compare the timestamps vs. the current timestamps, move the vetting of delegated timestamps wholly into nfsd. Rename the set_cb_time() helper to nfsd4_vet_deleg_time(), and make it non-static. Add a new vet_deleg_attrs() helper that is called from nfsd4_setattr that uses nfsd4_vet_deleg_time() to properly validate the all the timestamps. If the validation indicates that the update should be skipped, unset the appropriate flags in ia_valid. Signed-off-by: Jeff Layton --- fs/nfsd/nfs4proc.c | 31 ++++++++++++++++++++++++++++++- fs/nfsd/nfs4state.c | 24 +++++++++++------------- fs/nfsd/state.h | 3 +++ 3 files changed, 44 insertions(+), 14 deletions(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 7043fc475458d3b602010b47f489a3caba85e3ca..aacd912a5fbe29ba5ccac206d13= 243308f36b7fa 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1133,6 +1133,33 @@ nfsd4_secinfo_no_name_release(union nfsd4_op_u *u) exp_put(u->secinfo_no_name.sin_exp); } =20 +/* + * Validate that the requested timestamps are within the acceptable range.= If + * timestamp appears to be in the future, then it will be clamped to + * current_time(). + */ +static void +vet_deleg_attrs(struct nfsd4_setattr *setattr, struct nfs4_delegation *dp) +{ + struct timespec64 now =3D current_time(dp->dl_stid.sc_file->fi_inode); + struct iattr *iattr =3D &setattr->sa_iattr; + + if ((setattr->sa_bmval[2] & FATTR4_WORD2_TIME_DELEG_ACCESS) && + !nfsd4_vet_deleg_time(&iattr->ia_atime, &dp->dl_atime, &now)) + iattr->ia_valid &=3D ~(ATTR_ATIME | ATTR_ATIME_SET); + + if (setattr->sa_bmval[2] & FATTR4_WORD2_TIME_DELEG_MODIFY) { + if (nfsd4_vet_deleg_time(&iattr->ia_mtime, &dp->dl_mtime, &now)) { + iattr->ia_ctime =3D iattr->ia_mtime; + if (!nfsd4_vet_deleg_time(&iattr->ia_ctime, &dp->dl_ctime, &now)) + iattr->ia_valid &=3D ~(ATTR_CTIME | ATTR_CTIME_SET); + } else { + iattr->ia_valid &=3D ~(ATTR_CTIME | ATTR_CTIME_SET | + ATTR_MTIME | ATTR_MTIME_SET); + } + } +} + static __be32 nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, union nfsd4_op_u *u) @@ -1170,8 +1197,10 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_c= ompound_state *cstate, struct nfs4_delegation *dp =3D delegstateid(st); =20 /* Only for *_ATTRS_DELEG flavors */ - if (deleg_attrs_deleg(dp->dl_type)) + if (deleg_attrs_deleg(dp->dl_type)) { + vet_deleg_attrs(setattr, dp); status =3D nfs_ok; + } } } if (st) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 8737b721daf3433bab46065e751175a4dcdd1c89..f2fd0cbe256b9519eaa5cb0cc18= 872e08020edd3 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -9135,25 +9135,25 @@ nfsd4_get_writestateid(struct nfsd4_compound_state = *cstate, } =20 /** - * set_cb_time - vet and set the timespec for a cb_getattr update - * @cb: timestamp from the CB_GETATTR response + * nfsd4_vet_deleg_time - vet and set the timespec for a delegated timesta= mp update + * @req: timestamp from the client * @orig: original timestamp in the inode * @now: current time * - * Given a timestamp in a CB_GETATTR response, check it against the + * Given a timestamp from the client response, check it against the * current timestamp in the inode and the current time. Returns true * if the inode's timestamp needs to be updated, and false otherwise. - * @cb may also be changed if the timestamp needs to be clamped. + * @req may also be changed if the timestamp needs to be clamped. */ -static bool set_cb_time(struct timespec64 *cb, const struct timespec64 *or= ig, - const struct timespec64 *now) +bool nfsd4_vet_deleg_time(struct timespec64 *req, const struct timespec64 = *orig, + const struct timespec64 *now) { =20 /* * "When the time presented is before the original time, then the * update is ignored." Also no need to update if there is no change. */ - if (timespec64_compare(cb, orig) <=3D 0) + if (timespec64_compare(req, orig) <=3D 0) return false; =20 /* @@ -9161,10 +9161,8 @@ static bool set_cb_time(struct timespec64 *cb, const= struct timespec64 *orig, * clamp the new time to the current time, or it may * return NFS4ERR_DELAY to the client, allowing it to retry." */ - if (timespec64_compare(cb, now) > 0) { - /* clamp it */ - *cb =3D *now; - } + if (timespec64_compare(req, now) > 0) + *req =3D *now; =20 return true; } @@ -9184,10 +9182,10 @@ static int cb_getattr_update_times(struct dentry *d= entry, struct nfs4_delegation attrs.ia_atime =3D ncf->ncf_cb_atime; attrs.ia_mtime =3D ncf->ncf_cb_mtime; =20 - if (set_cb_time(&attrs.ia_atime, &atime, &now)) + if (nfsd4_vet_deleg_time(&attrs.ia_atime, &atime, &now)) attrs.ia_valid |=3D ATTR_ATIME | ATTR_ATIME_SET; =20 - if (set_cb_time(&attrs.ia_mtime, &mtime, &now)) { + if (nfsd4_vet_deleg_time(&attrs.ia_mtime, &mtime, &now)) { attrs.ia_valid |=3D ATTR_CTIME | ATTR_CTIME_SET | ATTR_MTIME | ATTR_MTIME_SET; attrs.ia_ctime =3D attrs.ia_mtime; diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index ce7c0d129ba338e1269ed163266e1ee192cd02c5..bf9436cdb93c5dd5502ecf83433= ea311e3678711 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h @@ -247,6 +247,9 @@ static inline bool deleg_attrs_deleg(u32 dl_type) dl_type =3D=3D OPEN_DELEGATE_WRITE_ATTRS_DELEG; } =20 +bool nfsd4_vet_deleg_time(struct timespec64 *cb, const struct timespec64 *= orig, + const struct timespec64 *now); + #define cb_to_delegation(cb) \ container_of(cb, struct nfs4_delegation, dl_recall) =20 --=20 2.50.1 From nobody Mon Oct 6 01:26:48 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A12EE288CB2; Sat, 26 Jul 2025 14:32:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753540331; cv=none; b=tIdRE+KPHRQrKqURp5tiBbnA0IIjKyDkI9dvupcuSIcLt4k4kLmofXOC+YV5hIztaRgIji2iXpQpzTHSQBqnF/IhOc7UjfM7OjkvLLQt+efvj06jr+y1ISGdzAbxUQzh3S9V7NuDtnoMaRXfUWAtGKRlic3gtCC3UGQKT8oWVZc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753540331; c=relaxed/simple; bh=zb0KcsT4OeKcJsPoBb2cTusxxjt+L0Sv4EowLlwUSBg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Nc0FPevBiYg1PXI5NlHJ+kEXh5BBmF1darVSW/Qe+dUzmsnSyH5aoIe8WwF1Fb79iZeXHPtlNqTIVVxOytRi+bFqBmvQssTSvt9/9G9fkVdff+xeeNcL69DrHivU/JXIrM6sUnY3aGx6u5sCOchfgzVDf6pLg0iJ0bj7ycNh4+Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZJathtJl; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZJathtJl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDEB7C4CEEF; Sat, 26 Jul 2025 14:32:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753540331; bh=zb0KcsT4OeKcJsPoBb2cTusxxjt+L0Sv4EowLlwUSBg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ZJathtJl6Qc5AIywrU6xkq4iz2DDXWXGA195ArJA3O3vG/KutzcYts1q0bkATYoAn /l5YI/HOG4z2plsC3kXfQvim/bAp6w0YfC0SHrJkz8LgcaAet+QOwfvARPP+P8+7pV gibkv0LgPUEQU6Ky3V1EoSVZKYhpIUSM/LqI3LaLudkztQWuWLYQINwE+ono0TtuQs mgXNa6BZ6TYYG3J/KwF0Ja1EhN8QtEJ2xAqMRvTHb6eaxPXRXCF4BdaMy9ioK/w8nk dEBKjfw0lF8fEnJmGQr5Ow9nUbhqjxav6Byv/4jpsZypxH47nCjR6zPOnXnYQ61td0 ClpUycEIG+TJQ== From: Jeff Layton Date: Sat, 26 Jul 2025 10:32:00 -0400 Subject: [PATCH v2 6/7] nfsd: fix timestamp updates in CB_GETATTR Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250726-nfsd-testing-v2-6-f45923db2fbb@kernel.org> References: <20250726-nfsd-testing-v2-0-f45923db2fbb@kernel.org> In-Reply-To: <20250726-nfsd-testing-v2-0-f45923db2fbb@kernel.org> To: Alexander Viro , Christian Brauner , Jan Kara , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Chuck Lever , NeilBrown , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: Trond Myklebust , Anna Schumaker , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, Jeff Layton X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1746; i=jlayton@kernel.org; h=from:subject:message-id; bh=zb0KcsT4OeKcJsPoBb2cTusxxjt+L0Sv4EowLlwUSBg=; b=owEBbQKS/ZANAwAKAQAOaEEZVoIVAcsmYgBohObf1TPeq9m7xz8YWWL9mSQu3CXambxR1PxaD CJU0tQ0iVyJAjMEAAEKAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCaITm3wAKCRAADmhBGVaC FXeSEACQIQ9O8jm73/8xMlQuOaKCOIHfiN0E9/v5AZJyrG30CYYwrBqtvWGV9iD9/xCLKsT8Tmw UZeh1zLzYZXH9mEDMp1Majg4PnKXsnyd7NG9QFbOda41nkNn1agtjG4ScGs8UjJFYdtqLBLc24C bNnSzNtr/Ht2DEb8Xi5MR/GJruq0eV2TopEcACJyjTajeJIMQ32xfhfjlqimnVDDESWta+Y+2aZ 0xDOz/nBVDDFLnErgN9sIuqVj9IzJpc6XxTVmCfEnbetHLKt5spdUxVArew1l6OGdFIbpp3VsLk biy1wcM07hRh/3jxb1uZUGlNf+I6LGDwfrLXxa+ELHKz9HSBWLS/4d1b3Ic7SI/Jo3mR2Ky5RRc iHQnqkL3nD5FMKU69ptuqscC0ZcZrRYAS5i1ChlTuB2WtJ22QyJz5D1EwuE9HpG7oZmRGZ5N+Vb Tc85r/Np8V7zFPaPx+Khiwl9tzqgsF8W7LxDxM2jIgkBYa+wRRwIEDVXD3CEK+lhH3eRb2vo9JW 9K7iPtZrBhM7tBKTo3N8Be+0SCwmkIIUXL6K3W926wf6m/ksHRjFk4lrU84JQYVWfQuaw52UtUO C2DhV+FawVTZOn8kb8NFt9Ugk9pmlXvQoKMMWZrHZdIU6Y3rdb05evlBP/fNVl5MXEG60XwPVZk aGwrEjvQrSE1bPQ== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 When updating the local timestamps from CB_GETATTR, the updated values are not being properly vetted. Compare the update times vs. the saved times in the delegation rather than the current times in the inode. Also, ensure that the ctime is properly vetted vs. its original value. Signed-off-by: Jeff Layton --- fs/nfsd/nfs4state.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index f2fd0cbe256b9519eaa5cb0cc18872e08020edd3..205ee8cc6fa2b9f74d08f7938b3= 23d03bdf8286c 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -9175,20 +9175,19 @@ static int cb_getattr_update_times(struct dentry *d= entry, struct nfs4_delegation int ret; =20 if (deleg_attrs_deleg(dp->dl_type)) { - struct timespec64 atime =3D inode_get_atime(inode); - struct timespec64 mtime =3D inode_get_mtime(inode); struct timespec64 now =3D current_time(inode); =20 attrs.ia_atime =3D ncf->ncf_cb_atime; attrs.ia_mtime =3D ncf->ncf_cb_mtime; =20 - if (nfsd4_vet_deleg_time(&attrs.ia_atime, &atime, &now)) + if (nfsd4_vet_deleg_time(&attrs.ia_atime, &dp->dl_atime, &now)) attrs.ia_valid |=3D ATTR_ATIME | ATTR_ATIME_SET; =20 - if (nfsd4_vet_deleg_time(&attrs.ia_mtime, &mtime, &now)) { - attrs.ia_valid |=3D ATTR_CTIME | ATTR_CTIME_SET | - ATTR_MTIME | ATTR_MTIME_SET; + if (nfsd4_vet_deleg_time(&attrs.ia_mtime, &dp->dl_mtime, &now)) { + attrs.ia_valid |=3D ATTR_MTIME | ATTR_MTIME_SET; attrs.ia_ctime =3D attrs.ia_mtime; + if (nfsd4_vet_deleg_time(&attrs.ia_ctime, &dp->dl_ctime, &now)) + attrs.ia_valid |=3D ATTR_CTIME | ATTR_CTIME_SET; } } else { attrs.ia_valid |=3D ATTR_MTIME | ATTR_CTIME; --=20 2.50.1 From nobody Mon Oct 6 01:26:48 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0BB1C28936F; Sat, 26 Jul 2025 14:32:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753540333; cv=none; b=Wyodpvx0trmnTSkgltkO23Gnh7vVbgi9KextIQX+/xxqgzcVhxgqhKdMxWa/Q6kUm6wLssJblqbzTKuFUokJsW6j9AZGS3tQaU4TODfR61AemoZ3DIGs8stVKdmIk/7QR48eavTUmPPIFAbvFy/SdI2oq55iFGMJ4hl4LPYBwtg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753540333; c=relaxed/simple; bh=NtCz+vb0FJ2RTT3UYGTBXP803cbE2/PCFHkn1707tww=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=A6CXd5h0ruZIMEkCI/13r+g9tUbHJlWLoljgTXDHyEK76srnN6ZS4P1aqOUV8AHz+ENX0JTHuao28nLwxJgmgnFoTL96kl6IuoGcS/DDw7BzJOSHIgJtNg1JoD4Yh1JrBQuDIfY0Pv6u9OlBzmb0ulmoPA/bHeQqr6PH2KwfvqQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iHbAY46e; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iHbAY46e" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EB26C4CEED; Sat, 26 Jul 2025 14:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753540332; bh=NtCz+vb0FJ2RTT3UYGTBXP803cbE2/PCFHkn1707tww=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=iHbAY46eB77ibHvlOxhtGzmUE1sb1iFmTO63dvTqcMnmlJQwUzKz0BC/lQ0Z4QQdk aKIQRRtMn5D7Hf+ol/ujlcfxUbdSkRMJw7bHJUOcBi7JlAlyOy348FrXwj5EQVYmMD CUt/ErbZle8WvrmsP031QpxojFFrn3JgcUbCNrziVp56TphPY44XM/OYxv1h64rdsC mTsl9OAKR0quCyG/C8ncrtnCxUeh8c0i71Rki+0toE4gLD24K5peRPXwt4P2hhBlVa LlcWvU1zlulgGb8gGz3/m97bte57iVgf/xLfnguqo7IlqOhUe6TWmgZ+dH5gI4Xy1b TLmqX4+/YEbww== From: Jeff Layton Date: Sat, 26 Jul 2025 10:32:01 -0400 Subject: [PATCH v2 7/7] vfs: remove inode_set_ctime_deleg() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250726-nfsd-testing-v2-7-f45923db2fbb@kernel.org> References: <20250726-nfsd-testing-v2-0-f45923db2fbb@kernel.org> In-Reply-To: <20250726-nfsd-testing-v2-0-f45923db2fbb@kernel.org> To: Alexander Viro , Christian Brauner , Jan Kara , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Chuck Lever , NeilBrown , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: Trond Myklebust , Anna Schumaker , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, Jeff Layton X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5364; i=jlayton@kernel.org; h=from:subject:message-id; bh=NtCz+vb0FJ2RTT3UYGTBXP803cbE2/PCFHkn1707tww=; b=owEBbQKS/ZANAwAKAQAOaEEZVoIVAcsmYgBohObfe2BC+vdrfTiozPM03vDHTOGmPGlfSvgEP FnJ33MaV3iJAjMEAAEKAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCaITm3wAKCRAADmhBGVaC FRlMD/9CXJXXovQtZBYhhN0mZIjmM2OgSM/Qn1wsOwJygUX2FkKQuQKm78o8x71HdKYq0YJgyBX vUmxutDHxFHyo/EtVIftLtmSYFSqZWNm5L9NmeSG6Rr4TDIbRCDDgBcaMqwDelSjnaNmRFMkSXp OW0oIjbl4MjG2u388ktJtp8Bpw9Xb6LZW8876aNBBfyxu57EAxGjE5qs8TUMj+z3xiejJtTX5uQ CJOMR3AzqPHRcv7uoXusmVQ3v+yuWRXgoM7PMCEXLW/xwWGm4QfFvJxB/JEHw1fdKILHNQLjelx 5+bEJ7Y8WtNTiqQIHjaNWwIaTY2441Pic0N4Y0KzV360bec3o8fFkZl09gzEvAfwMA4Dt8SQEKo ULTIT56TjQnQDJffjwrDnqDy1deFe5VkdIViIGXTegxYUnzkp1G2w1TIXhrLeQl/RxEmzNbxfkc RRZdUsOJlFGsEIjZdHMXIjas7zOurEwkhbQx11y4z9PFDOof5P18oglPNTP2Tywp+uE9366S03m J70xF0FI9UWi2P6Ah0AZ6NITqr9gH2mb1efquuNHMSj9BSH9r3V9wEMFukBcXDGb8ny2MieSMcj wMp8fJPYhOJ6v3NQgkcX56f+j+wl7bHQtmthiUbD1Yd2YP5s0qvW07SeasopAtS3qpNmN29diOS cV/EMgqPxed7ulw== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 Now that nfsd is vetting the timestamps internally, there is no need for this function. If ATTR_DELEG is set, then skip the multigrain update and set what was requested. Signed-off-by: Jeff Layton --- fs/attr.c | 19 +++----------- fs/inode.c | 73 --------------------------------------------------= ---- include/linux/fs.h | 2 -- 3 files changed, 4 insertions(+), 90 deletions(-) diff --git a/fs/attr.c b/fs/attr.c index f0dabd2985989d283a931536a5fc53eda366b373..e75f06b760015640bafd596457c= d14c746c7e272 100644 --- a/fs/attr.c +++ b/fs/attr.c @@ -287,14 +287,7 @@ static void setattr_copy_mgtime(struct inode *inode, c= onst struct iattr *attr) struct timespec64 now; =20 if (ia_valid & ATTR_CTIME) { - /* - * In the case of an update for a write delegation, we must respect - * the value in ia_ctime and not use the current time. - */ - if (ia_valid & ATTR_DELEG) - now =3D inode_set_ctime_deleg(inode, attr->ia_ctime); - else - now =3D inode_set_ctime_current(inode); + now =3D inode_set_ctime_current(inode); } else { /* If ATTR_CTIME isn't set, then ATTR_MTIME shouldn't be either. */ WARN_ON_ONCE(ia_valid & ATTR_MTIME); @@ -352,19 +345,15 @@ void setattr_copy(struct mnt_idmap *idmap, struct ino= de *inode, inode->i_mode =3D mode; } =20 - if (is_mgtime(inode)) + if (!(ia_valid & ATTR_DELEG) && is_mgtime(inode)) return setattr_copy_mgtime(inode, attr); =20 if (ia_valid & ATTR_ATIME) inode_set_atime_to_ts(inode, attr->ia_atime); if (ia_valid & ATTR_MTIME) inode_set_mtime_to_ts(inode, attr->ia_mtime); - if (ia_valid & ATTR_CTIME) { - if (ia_valid & ATTR_DELEG) - inode_set_ctime_deleg(inode, attr->ia_ctime); - else - inode_set_ctime_to_ts(inode, attr->ia_ctime); - } + if (ia_valid & ATTR_CTIME) + inode_set_ctime_to_ts(inode, attr->ia_ctime); } EXPORT_SYMBOL(setattr_copy); =20 diff --git a/fs/inode.c b/fs/inode.c index 99318b157a9a13b3dd8dad0f5f90951f08ef64de..f45054fe48b8a0339e60fd2aa17= daaad5a7957e7 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -2783,79 +2783,6 @@ struct timespec64 inode_set_ctime_current(struct ino= de *inode) } EXPORT_SYMBOL(inode_set_ctime_current); =20 -/** - * inode_set_ctime_deleg - try to update the ctime on a delegated inode - * @inode: inode to update - * @update: timespec64 to set the ctime - * - * Attempt to atomically update the ctime on behalf of a delegation holder. - * - * The nfs server can call back the holder of a delegation to get updated - * inode attributes, including the mtime. When updating the mtime, update - * the ctime to a value at least equal to that. - * - * This can race with concurrent updates to the inode, in which - * case the update is skipped. - * - * Note that this works even when multigrain timestamps are not enabled, - * so it is used in either case. - */ -struct timespec64 inode_set_ctime_deleg(struct inode *inode, struct timesp= ec64 update) -{ - struct timespec64 now, cur_ts; - u32 cur, old; - - /* pairs with try_cmpxchg below */ - cur =3D smp_load_acquire(&inode->i_ctime_nsec); - cur_ts.tv_nsec =3D cur & ~I_CTIME_QUERIED; - cur_ts.tv_sec =3D inode->i_ctime_sec; - - /* If the update is older than the existing value, skip it. */ - if (timespec64_compare(&update, &cur_ts) <=3D 0) - return cur_ts; - - ktime_get_coarse_real_ts64_mg(&now); - - /* Clamp the update to "now" if it's in the future */ - if (timespec64_compare(&update, &now) > 0) - update =3D now; - - update =3D timestamp_truncate(update, inode); - - /* No need to update if the values are already the same */ - if (timespec64_equal(&update, &cur_ts)) - return cur_ts; - - /* - * Try to swap the nsec value into place. If it fails, that means - * it raced with an update due to a write or similar activity. That - * stamp takes precedence, so just skip the update. - */ -retry: - old =3D cur; - if (try_cmpxchg(&inode->i_ctime_nsec, &cur, update.tv_nsec)) { - inode->i_ctime_sec =3D update.tv_sec; - mgtime_counter_inc(mg_ctime_swaps); - return update; - } - - /* - * Was the change due to another task marking the old ctime QUERIED? - * - * If so, then retry the swap. This can only happen once since - * the only way to clear I_CTIME_QUERIED is to stamp the inode - * with a new ctime. - */ - if (!(old & I_CTIME_QUERIED) && (cur =3D=3D (old | I_CTIME_QUERIED))) - goto retry; - - /* Otherwise, it was a new timestamp. */ - cur_ts.tv_sec =3D inode->i_ctime_sec; - cur_ts.tv_nsec =3D cur & ~I_CTIME_QUERIED; - return cur_ts; -} -EXPORT_SYMBOL(inode_set_ctime_deleg); - /** * in_group_or_capable - check whether caller is CAP_FSETID privileged * @idmap: idmap of the mount @inode was found from diff --git a/include/linux/fs.h b/include/linux/fs.h index f18f45e88545c39716b917b1378fb7248367b41d..08f2d813dd40b5dd4fe07d9636e= 94252915d6235 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1657,8 +1657,6 @@ static inline bool fsuidgid_has_mapping(struct super_= block *sb, =20 struct timespec64 current_time(struct inode *inode); struct timespec64 inode_set_ctime_current(struct inode *inode); -struct timespec64 inode_set_ctime_deleg(struct inode *inode, - struct timespec64 update); =20 static inline time64_t inode_get_atime_sec(const struct inode *inode) { --=20 2.50.1