sunrpc: fix up the special handling of sv_nrpools == 1
authorJeff Layton <jlayton@kernel.org>
Thu, 13 Jun 2024 18:34:30 +0000 (14:34 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 8 Jul 2024 18:10:04 +0000 (14:10 -0400)
commit8e0c8d23952f338180d19718195d4f9fd10a1809
tree1508f67af7fc549affab2e43ab9f43d9cccad21d
parent3a6adfcae8c4ac45f19c141958e8778359f40173
sunrpc: fix up the special handling of sv_nrpools == 1

Only pooled services take a reference to the svc_pool_map. The sunrpc
code has always used the sv_nrpools value to detect whether the service
is pooled.

The problem there is that nfsd is a pooled service, but when it's
running in "global" pool_mode, it doesn't take a reference to the pool
map because it has a sv_nrpools value of 1. This means that we have
two separate codepaths for starting the server, depending on whether
it's pooled or not.

Fix this by adding a new flag to the svc_serv, that indicates whether
the serv is pooled. With this we can have the nfsd service
unconditionally take a reference, regardless of pool_mode.

Note that this is a behavior change for
/sys/module/sunrpc/parameters/pool_mode. Usually this file does not
allow you to change the pool-mode while there are nfsd threads running,
but if the pool-mode is "global" it's allowed. My assumption is that
this is a bug, since it probably should never have worked this way.

This patch changes the behavior such that you get back EBUSY even
when nfsd is running in global mode. I think this is more reasonable
behavior, and given that most people set this today using the module
parameter, it's doubtful anyone will notice.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
include/linux/sunrpc/svc.h
net/sunrpc/svc.c