]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
nfs_localio: change nfsd_file_put_local() to take a pointer to __rcu pointer
authorNeilBrown <neil@brown.name>
Fri, 9 May 2025 00:46:43 +0000 (10:46 +1000)
committerAnna Schumaker <anna.schumaker@oracle.com>
Wed, 28 May 2025 21:17:14 +0000 (17:17 -0400)
commitc25a89770d1f216dcedfc2d25d56b604f62ce0bd
treee5e0c6ebad5ceb43497f1a50ec9d99e84b8285eb
parent21fb44034695185f1dcbcb37354c842cabfe83c1
nfs_localio: change nfsd_file_put_local() to take a pointer to __rcu pointer

Instead of calling xchg() and unrcu_pointer() before
nfsd_file_put_local(), we now pass pointer to the __rcu pointer and call
xchg() and unrcu_pointer() inside that function.

Where unrcu_pointer() is currently called the internals of "struct
nfsd_file" are not known and that causes older compilers such as gcc-8
to complain.

In some cases we have a __kernel (aka normal) pointer not an __rcu
pointer so we need to cast it to __rcu first.  This is strictly a
weakening so no information is lost.  Somewhat surprisingly, this cast
is accepted by gcc-8.

This has the pleasing result that the cmpxchg() which sets ro_file and
rw_file, and also the xchg() which clears them, are both now in the nfsd
code.

Reported-by: Pali Rohár <pali@kernel.org>
Reported-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Fixes: 86e00412254a ("nfs: cache all open LOCALIO nfsd_file(s) in client")
Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
fs/nfs/localio.c
fs/nfs_common/nfslocalio.c
fs/nfsd/filecache.c
fs/nfsd/filecache.h
include/linux/nfslocalio.h