|
Revision tags: v6.15, v6.15-rc7, v6.15-rc6, v6.15-rc5, v6.15-rc4, v6.15-rc3, v6.15-rc2, v6.15-rc1, v6.14, v6.14-rc7, v6.14-rc6, v6.14-rc5, v6.14-rc4, v6.14-rc3, v6.14-rc2, v6.14-rc1, v6.13, v6.13-rc7, v6.13-rc6, v6.13-rc5, v6.13-rc4, v6.13-rc3 |
|
| #
a4b853f1 |
| 09-Dec-2024 |
NeilBrown <[email protected]> |
sunrpc: remove all connection limit configuration
Now that the connection limit only apply to unconfirmed connections, there is no need to configure it. So remove all the configuration and fix the
sunrpc: remove all connection limit configuration
Now that the connection limit only apply to unconfirmed connections, there is no need to configure it. So remove all the configuration and fix the number of unconfirmed connections as always 64 - which is now given a name: XPT_MAX_TMP_CONN
Signed-off-by: NeilBrown <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
show more ...
|
| #
eccbbc7c |
| 09-Dec-2024 |
NeilBrown <[email protected]> |
nfsd: don't use sv_nrthreads in connection limiting calculations.
The heuristic for limiting the number of incoming connections to nfsd currently uses sv_nrthreads - allowing more connections if mor
nfsd: don't use sv_nrthreads in connection limiting calculations.
The heuristic for limiting the number of incoming connections to nfsd currently uses sv_nrthreads - allowing more connections if more threads were configured.
A future patch will allow number of threads to grow dynamically so that there will be no need to configure sv_nrthreads. So we need a different solution for limiting connections.
It isn't clear what problem is solved by limiting connections (as mentioned in a code comment) but the most likely problem is a connection storm - many connections that are not doing productive work. These will be closed after about 6 minutes already but it might help to slow down a storm.
This patch adds a per-connection flag XPT_PEER_VALID which indicates that the peer has presented a filehandle for which it has some sort of access. i.e the peer is known to be trusted in some way. We now only count connections which have NOT been determined to be valid. There should be relative few of these at any given time.
If the number of non-validated peer exceed a limit - currently 64 - we close the oldest non-validated peer to avoid having too many of these useless connections.
Note that this patch significantly changes the meaning of the various configuration parameters for "max connections". The next patch will remove all of these.
Signed-off-by: NeilBrown <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
show more ...
|
|
Revision tags: v6.13-rc2 |
|
| #
6e1d75f7 |
| 06-Dec-2024 |
NeilBrown <[email protected]> |
sunrpc/svc: use store_release_wake_up()
svc_thread_init_status() contains an open-coded store_release_wake_up(). It is cleaner to use that function directly rather than needing to remember the barr
sunrpc/svc: use store_release_wake_up()
svc_thread_init_status() contains an open-coded store_release_wake_up(). It is cleaner to use that function directly rather than needing to remember the barrier.
Signed-off-by: NeilBrown <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
show more ...
|
|
Revision tags: v6.13-rc1, v6.12, v6.12-rc7, v6.12-rc6, v6.12-rc5, v6.12-rc4, v6.12-rc3, v6.12-rc2, v6.12-rc1, v6.11, v6.11-rc7 |
|
| #
86ab08be |
| 05-Sep-2024 |
NeilBrown <[email protected]> |
SUNRPC: replace program list with program array
A service created with svc_create_pooled() can be given a linked list of programs and all of these will be served.
Using a linked list makes it cumbe
SUNRPC: replace program list with program array
A service created with svc_create_pooled() can be given a linked list of programs and all of these will be served.
Using a linked list makes it cumbersome when there are several programs that can be optionally selected with CONFIG settings.
After this patch is applied, API consumers must use only svc_create_pooled() when creating an RPC service that listens for more than one RPC program.
Signed-off-by: NeilBrown <[email protected]> Signed-off-by: Mike Snitzer <[email protected]> Acked-by: Chuck Lever <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
show more ...
|
| #
3391fc92 |
| 15-Sep-2024 |
NeilBrown <[email protected]> |
sunrpc: allow svc threads to fail initialisation cleanly
If an svc thread needs to perform some initialisation that might fail, it has no good way to handle the failure.
Before the thread can exit
sunrpc: allow svc threads to fail initialisation cleanly
If an svc thread needs to perform some initialisation that might fail, it has no good way to handle the failure.
Before the thread can exit it must call svc_exit_thread(), but that requires the service mutex to be held. The thread cannot simply take the mutex as that could deadlock if there is a concurrent attempt to shut down all threads (which is unlikely, but not impossible).
nfsd currently call svc_exit_thread() unprotected in the unlikely event that unshare_fs_struct() fails.
We can clean this up by introducing svc_thread_init_status() by which an svc thread can report whether initialisation has succeeded. If it has, it continues normally into the action loop. If it has not, svc_thread_init_status() immediately aborts the thread. svc_start_kthread() waits for either of these to happen, and calls svc_exit_thread() (under the mutex) if the thread aborted.
Signed-off-by: NeilBrown <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
show more ...
|
|
Revision tags: v6.11-rc6, v6.11-rc5, v6.11-rc4, v6.11-rc3, v6.11-rc2, v6.11-rc1 |
|
| #
60749cbe |
| 15-Jul-2024 |
NeilBrown <[email protected]> |
sunrpc: change sp_nrthreads from atomic_t to unsigned int.
sp_nrthreads is only ever accessed under the service mutex nlmsvc_mutex nfs_callback_mutex nfsd_mutex so these is no need for it to be an
sunrpc: change sp_nrthreads from atomic_t to unsigned int.
sp_nrthreads is only ever accessed under the service mutex nlmsvc_mutex nfs_callback_mutex nfsd_mutex so these is no need for it to be an atomic_t.
The fact that all code using it is single-threaded means that we can simplify svc_pool_victim and remove the temporary elevation of sp_nrthreads.
Signed-off-by: NeilBrown <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
show more ...
|
| #
f2b27e1d |
| 15-Jul-2024 |
NeilBrown <[email protected]> |
SUNRPC: make various functions static, or not exported.
Various functions are only used within the sunrpc module, and several are only use in the one file. So clean up:
These are marked static, an
SUNRPC: make various functions static, or not exported.
Various functions are only used within the sunrpc module, and several are only use in the one file. So clean up:
These are marked static, and any EXPORT is removed. svc_rcpb_setup() svc_rqst_alloc() svc_rqst_free() - also moved before first use svc_rpcbind_set_version() svc_drop() - also moved to svc.c
These are now not EXPORTed, but are not static. svc_authenticate() svc_sock_update_bufs()
Signed-off-by: NeilBrown <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
show more ...
|
|
Revision tags: v6.10, v6.10-rc7, v6.10-rc6, v6.10-rc5, v6.10-rc4 |
|
| #
5f71f3c3 |
| 13-Jun-2024 |
Jeff Layton <[email protected]> |
sunrpc: refactor pool_mode setting code
Allow the pool_mode setting code to be called from internal callers so we can call it from a new netlink op. Add a new svc_pool_map_get function to return the
sunrpc: refactor pool_mode setting code
Allow the pool_mode setting code to be called from internal callers so we can call it from a new netlink op. Add a new svc_pool_map_get function to return the current setting. Change the existing module parameter handling to use the new interfaces under the hood.
Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
show more ...
|
| #
8e0c8d23 |
| 13-Jun-2024 |
Jeff Layton <[email protected]> |
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 i
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 <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
show more ...
|
|
Revision tags: v6.10-rc3, v6.10-rc2, v6.10-rc1, v6.9, v6.9-rc7, v6.9-rc6, v6.9-rc5, v6.9-rc4, v6.9-rc3, v6.9-rc2, v6.9-rc1, v6.8, v6.8-rc7, v6.8-rc6, v6.8-rc5, v6.8-rc4, v6.8-rc3, v6.8-rc2 |
|
| #
3f6ef182 |
| 26-Jan-2024 |
Josef Bacik <[email protected]> |
sunrpc: remove ->pg_stats from svc_program
Now that this isn't used anywhere, remove it.
Signed-off-by: Josef Bacik <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-b
sunrpc: remove ->pg_stats from svc_program
Now that this isn't used anywhere, remove it.
Signed-off-by: Josef Bacik <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
show more ...
|
| #
f0943238 |
| 26-Jan-2024 |
Josef Bacik <[email protected]> |
sunrpc: pass in the sv_stats struct through svc_create_pooled
Since only one service actually reports the rpc stats there's not much of a reason to have a pointer to it in the svc_program struct. A
sunrpc: pass in the sv_stats struct through svc_create_pooled
Since only one service actually reports the rpc stats there's not much of a reason to have a pointer to it in the svc_program struct. Adjust the svc_create_pooled function to take the sv_stats as an argument and pass the struct through there as desired instead of getting it from the svc_program->pg_stats.
Signed-off-by: Josef Bacik <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
show more ...
|
|
Revision tags: v6.8-rc1, v6.7, v6.7-rc8, v6.7-rc7, v6.7-rc6 |
|
| #
1e3577a4 |
| 15-Dec-2023 |
NeilBrown <[email protected]> |
SUNRPC: discard sv_refcnt, and svc_get/svc_put
sv_refcnt is no longer useful. lockd and nfs-cb only ever have the svc active when there are a non-zero number of threads, so sv_refcnt mirrors sv_nrth
SUNRPC: discard sv_refcnt, and svc_get/svc_put
sv_refcnt is no longer useful. lockd and nfs-cb only ever have the svc active when there are a non-zero number of threads, so sv_refcnt mirrors sv_nrthreads.
nfsd also keeps the svc active between when a socket is added and when the first thread is started, but we don't really need a refcount for that. We can simply not destroy the svc while there are any permanent sockets attached.
So remove sv_refcnt and the get/put functions. Instead of a final call to svc_put(), call svc_destroy() instead. This is changed to also store NULL in the passed-in pointer to make it easier to avoid use-after-free situations.
Signed-off-by: NeilBrown <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
show more ...
|
| #
7b207ccd |
| 15-Dec-2023 |
NeilBrown <[email protected]> |
svc: don't hold reference for poolstats, only mutex.
A future patch will remove refcounting on svc_serv as it is of little use. It is currently used to keep the svc around while the pool_stats file
svc: don't hold reference for poolstats, only mutex.
A future patch will remove refcounting on svc_serv as it is of little use. It is currently used to keep the svc around while the pool_stats file is open. Change this to get the pointer, protected by the mutex, only in seq_start, and the release the mutex in seq_stop. This means that if the nfsd server is stopped and restarted while the pool_stats file it open, then some pool stats info could be from the first instance and some from the second. This might appear odd, but is unlikely to be a problem in practice.
Signed-off-by: NeilBrown <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
show more ...
|
|
Revision tags: v6.7-rc5, v6.7-rc4, v6.7-rc3, v6.7-rc2 |
|
| #
3587b5c7 |
| 17-Nov-2023 |
Chuck Lever <[email protected]> |
SUNRPC: Remove RQ_SPLICE_OK
This flag is no longer used.
Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
|
| #
57331a59 |
| 04-Jan-2024 |
Benjamin Coddington <[email protected]> |
NFSv4.1: Use the nfs_client's rpc timeouts for backchannel
For backchannel requests that lookup the appropriate nfs_client, use the state-management rpc_clnt's rpc_timeout parameters for the backcha
NFSv4.1: Use the nfs_client's rpc timeouts for backchannel
For backchannel requests that lookup the appropriate nfs_client, use the state-management rpc_clnt's rpc_timeout parameters for the backchannel's response. When the nfs_client cannot be found, fall back to using the xprt's default timeout parameters.
Signed-off-by: Benjamin Coddington <[email protected]> Tested-by: Chuck Lever <[email protected]> Tested-by: Jeff Layton <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
show more ...
|
|
Revision tags: v6.7-rc1, v6.6, v6.6-rc7, v6.6-rc6, v6.6-rc5, v6.6-rc4, v6.6-rc3, v6.6-rc2 |
|
| #
bd9d6a3e |
| 11-Sep-2023 |
Lorenzo Bianconi <[email protected]> |
NFSD: add rpc_status netlink support
Introduce rpc_status netlink support for NFSD in order to dump pending RPC requests debugging information from userspace.
Closes: https://bugzilla.linux-nfs.org
NFSD: add rpc_status netlink support
Introduce rpc_status netlink support for NFSD in order to dump pending RPC requests debugging information from userspace.
Closes: https://bugzilla.linux-nfs.org/show_bug.cgi?id=366 Tested-by: Jeff Layton <[email protected]> Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
show more ...
|
| #
15d39883 |
| 11-Sep-2023 |
NeilBrown <[email protected]> |
SUNRPC: change the back-channel queue to lwq
This removes the need to store and update back-links in the list. It also remove the need for the _bh version of spin_lock().
Signed-off-by: NeilBrown <
SUNRPC: change the back-channel queue to lwq
This removes the need to store and update back-links in the list. It also remove the need for the _bh version of spin_lock().
Signed-off-by: NeilBrown <[email protected]> Cc: Trond Myklebust <[email protected]> Cc: Anna Schumaker <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
show more ...
|
| #
580a2575 |
| 11-Sep-2023 |
NeilBrown <[email protected]> |
SUNRPC: discard sp_lock
sp_lock is now only used to protect sp_all_threads. This isn't needed as sp_all_threads is only manipulated through svc_set_num_threads(), which is already serialized. Read
SUNRPC: discard sp_lock
sp_lock is now only used to protect sp_all_threads. This isn't needed as sp_all_threads is only manipulated through svc_set_num_threads(), which is already serialized. Read-acccess only requires rcu_read_lock(). So no more locking is needed.
Signed-off-by: NeilBrown <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
show more ...
|
| #
2e8fc923 |
| 11-Sep-2023 |
NeilBrown <[email protected]> |
SUNRPC: change sp_nrthreads to atomic_t
Using an atomic_t avoids the need to take a spinlock (which can soon be removed).
Choosing a thread to kill needs to be careful as we cannot set the "die now
SUNRPC: change sp_nrthreads to atomic_t
Using an atomic_t avoids the need to take a spinlock (which can soon be removed).
Choosing a thread to kill needs to be careful as we cannot set the "die now" bit atomically with the test on the count. Instead we temporarily increase the count.
Signed-off-by: NeilBrown <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
show more ...
|
| #
9a0e6acc |
| 11-Sep-2023 |
NeilBrown <[email protected]> |
SUNRPC: use lwq for sp_sockets - renamed to sp_xprts
lwq avoids using back pointers in lists, and uses less locking. This introduces a new spinlock, but the other one will be removed in a future pat
SUNRPC: use lwq for sp_sockets - renamed to sp_xprts
lwq avoids using back pointers in lists, and uses less locking. This introduces a new spinlock, but the other one will be removed in a future patch.
For svc_clean_up_xprts(), we now dequeue the entire queue, walk it to remove and process the xprts that need cleaning up, then re-enqueue the remaining queue.
Signed-off-by: NeilBrown <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
show more ...
|
| #
5b80147e |
| 11-Sep-2023 |
NeilBrown <[email protected]> |
SUNRPC: only have one thread waking up at a time
Currently if several items of work become available in quick succession, that number of threads (if available) will be woken. By the time some of th
SUNRPC: only have one thread waking up at a time
Currently if several items of work become available in quick succession, that number of threads (if available) will be woken. By the time some of them wake up another thread that was already cache-warm might have come along and completed the work. Anecdotal evidence suggests as many as 15% of wakes find nothing to do once they get to the point of looking.
This patch changes svc_pool_wake_idle_thread() to wake the first thread on the queue but NOT remove it. Subsequent calls will wake the same thread. Once that thread starts it will dequeue itself and after dequeueing some work to do, it will wake the next thread if there is more work ready. This results in a more orderly increase in the number of busy threads.
As a bonus, this allows us to reduce locking around the idle queue. svc_pool_wake_idle_thread() no longer needs to take a lock (beyond rcu_read_lock()) as it doesn't manipulate the queue, it just looks at the first item.
The thread itself can avoid locking by using the new llist_del_first_this() interface. This will safely remove the thread itself if it is the head. If it isn't the head, it will do nothing. If multiple threads call this concurrently only one will succeed. The others will do nothing, so no corruption can result.
If a thread wakes up and finds that it cannot dequeue itself that means either - that it wasn't woken because it was the head of the queue. Maybe the freezer woke it. In that case it can go back to sleep (after trying to freeze of course). - some other thread found there was nothing to do very recently, and placed itself on the head of the queue in front of this thread. It must check again after placing itself there, so it can be deemed to be responsible for any pending work, and this thread can go back to sleep until woken.
No code ever tests for busy threads any more. Only each thread itself cares if it is busy. So svc_thread_busy() is no longer needed.
Signed-off-by: NeilBrown <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
show more ...
|
| #
9bd4161c |
| 11-Sep-2023 |
NeilBrown <[email protected]> |
SUNRPC: change service idle list to be an llist
With an llist we don't need to take a lock to add a thread to the list, though we still need a lock to remove it. That will go in the next patch.
Un
SUNRPC: change service idle list to be an llist
With an llist we don't need to take a lock to add a thread to the list, though we still need a lock to remove it. That will go in the next patch.
Unlike double-linked lists, a thread cannot reliably remove itself from the list. Only the first thread can be removed, and that can change asynchronously. So some care is needed.
We already check if there is pending work to do, so we are unlikely to add ourselves to the idle list and then want to remove ourselves again.
If we DO find something needs to be done after adding ourselves to the list, we simply wake up the first thread on the list. If that was us, we successfully removed ourselves and can continue. If it was some other thread, they will do the work that needs to be done. We can safely sleep until woken.
We also remove the test on freezing() from rqst_should_sleep(). Instead we set TASK_FREEZABLE before scheduling. This makes is safe to schedule() when a freeze is pending. As we now loop waiting to be removed from the idle queue, this is a cleaner way to handle freezing.
Signed-off-by: NeilBrown <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
show more ...
|
| #
2b65a226 |
| 11-Sep-2023 |
NeilBrown <[email protected]> |
SUNRPC: discard SP_CONGESTED
We can tell if a pool is congested by checking if the idle list is empty. We don't need a separate flag.
Signed-off-by: NeilBrown <[email protected]> Signed-off-by: Chuck
SUNRPC: discard SP_CONGESTED
We can tell if a pool is congested by checking if the idle list is empty. We don't need a separate flag.
Signed-off-by: NeilBrown <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
show more ...
|
| #
5ff817b2 |
| 11-Sep-2023 |
NeilBrown <[email protected]> |
SUNRPC: add list of idle threads
Rather than searching a list of threads to find an idle one, having a list of idle threads allows an idle thread to be found immediately.
This adds some spin_lock c
SUNRPC: add list of idle threads
Rather than searching a list of threads to find an idle one, having a list of idle threads allows an idle thread to be found immediately.
This adds some spin_lock calls which is not ideal, but as the hold-time is tiny it is still faster than searching a list. A future patch will remove them using llist.h. This involves some subtlety and so is left to a separate patch.
This removes the need for the RQ_BUSY flag. The rqst is "busy" precisely when it is not on the "idle" list.
Signed-off-by: NeilBrown <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
show more ...
|
| #
fa341560 |
| 11-Sep-2023 |
NeilBrown <[email protected]> |
SUNRPC: change how svc threads are asked to exit.
svc threads are currently stopped using kthread_stop(). This requires identifying a specific thread. However we don't care which thread stops, jus
SUNRPC: change how svc threads are asked to exit.
svc threads are currently stopped using kthread_stop(). This requires identifying a specific thread. However we don't care which thread stops, just as long as one does.
So instead, set a flag in the svc_pool to say that a thread needs to die, and have each thread check this flag instead of calling kthread_should_stop(). The first thread to find and clear this flag then moves towards exiting.
This removes an explicit dependency on sp_all_threads which will make a future patch simpler.
Signed-off-by: NeilBrown <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
show more ...
|