linux-stable/fs/lockd
NeilBrown 89aac0345e lockd: drop inappropriate svc_get() from locked_get()
[ Upstream commit 665e89ab7c ]

The below-mentioned patch was intended to simplify refcounting on the
svc_serv used by locked.  The goal was to only ever have a single
reference from the single thread.  To that end we dropped a call to
lockd_start_svc() (except when creating thread) which would take a
reference, and dropped the svc_put(serv) that would drop that reference.

Unfortunately we didn't also remove the svc_get() from
lockd_create_svc() in the case where the svc_serv already existed.
So after the patch:
 - on the first call the svc_serv was allocated and the one reference
   was given to the thread, so there are no extra references
 - on subsequent calls svc_get() was called so there is now an extra
   reference.
This is clearly not consistent.

The inconsistency is also clear in the current code in lockd_get()
takes *two* references, one on nlmsvc_serv and one by incrementing
nlmsvc_users.   This clearly does not match lockd_put().

So: drop that svc_get() from lockd_get() (which used to be in
lockd_create_svc().

Reported-by: Ido Schimmel <idosch@idosch.org>
Closes: https://lore.kernel.org/linux-nfs/ZHsI%2FH16VX9kJQX1@shredder/T/#u
Fixes: b73a297204 ("lockd: move lockd_start_svc() call into lockd_create_svc()")
Signed-off-by: NeilBrown <neilb@suse.de>
Tested-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-07-11 19:39:21 +02:00
..
Makefile
clnt4xdr.c lockd: set file_lock start and end when decoding nlm4 testargs 2023-03-14 14:00:55 -04:00
clntlock.c fs: remove locks_inode 2023-01-11 06:52:43 -05:00
clntproc.c fs: remove locks_inode 2023-01-11 06:52:43 -05:00
clntxdr.c NFS: Remove print_overflow_msg() 2019-02-13 11:53:45 -05:00
host.c lockd: move from strlcpy with unused retval to strscpy 2022-09-26 14:02:20 -04:00
mon.c Replace HTTP links with HTTPS ones: NFS, SUNRPC, and LOCKD clients 2020-09-21 10:21:10 -04:00
netns.h filelock: move file locking definitions to separate header file 2023-01-11 06:52:32 -05:00
procfs.c proc: convert everything to "struct proc_ops" 2020-02-04 03:05:26 +00:00
procfs.h
svc.c lockd: drop inappropriate svc_get() from locked_get() 2023-07-11 19:39:21 +02:00
svc4proc.c lockd: set missing fl_flags field when retrieving args 2022-12-10 11:01:11 -05:00
svclock.c lockd: fix file selection in nlmsvc_cancel_blocked 2022-12-10 11:01:11 -05:00
svcproc.c lockd: set missing fl_flags field when retrieving args 2022-12-10 11:01:11 -05:00
svcshare.c
svcsubs.c NFSD 6.2 Release Notes 2022-12-12 20:54:39 -08:00
svcxdr.h NLM: Fix svcxdr_encode_owner() 2021-09-17 10:35:10 -04:00
xdr.c SUNRPC: Change return value type of .pc_encode 2021-10-13 11:34:49 -04:00
xdr4.c lockd: set file_lock start and end when decoding nlm4 testargs 2023-03-14 14:00:55 -04:00