]> git.baikalelectronics.ru Git - kernel.git/commit
NFSD: enhance inter-server copy cleanup
authorDai Ngo <dai.ngo@oracle.com>
Mon, 19 Dec 2022 00:55:53 +0000 (16:55 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:33:24 +0000 (09:33 +0100)
commit26762f55aba5b2607e29846aeb1401abcfd9935e
tree72809421c8630f819a68921978b920cc3c6e15e1
parent8b09742a5ac7460693d155ecee9800c60531cdbf
NFSD: enhance inter-server copy cleanup

[ Upstream commit 3a79990b6e866379c812b32323327fd492da16c0 ]

Currently nfsd4_setup_inter_ssc returns the vfsmount of the source
server's export when the mount completes. After the copy is done
nfsd4_cleanup_inter_ssc is called with the vfsmount of the source
server and it searches nfsd_ssc_mount_list for a matching entry
to do the clean up.

The problems with this approach are (1) the need to search the
nfsd_ssc_mount_list and (2) the code has to handle the case where
the matching entry is not found which looks ugly.

The enhancement is instead of nfsd4_setup_inter_ssc returning the
vfsmount, it returns the nfsd4_ssc_umount_item which has the
vfsmount embedded in it. When nfsd4_cleanup_inter_ssc is called
it's passed with the nfsd4_ssc_umount_item directly to do the
clean up so no searching is needed and there is no need to handle
the 'not found' case.

Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
[ cel: adjusted whitespace and variable/function names ]
Reviewed-by: Olga Kornievskaia <kolga@netapp.com>
Stable-dep-of: 0d8218dbf6bd ("NFSD: fix leaked reference count of nfsd4_ssc_umount_item")
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfsd/nfs4proc.c
fs/nfsd/xdr4.h
include/linux/nfs_ssc.h