mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
SUNRPC/auth: async tasks mustn't block waiting for memory
When memory is short, new worker threads cannot be created and we depend on the minimum one rpciod thread to be able to handle everything. So it must not block waiting for memory. mempools are particularly a problem as memory can only be released back to the mempool by an async rpc task running. If all available workqueue threads are waiting on the mempool, no thread is available to return anything. lookup_cred() can block on a mempool or kmalloc - and this can cause deadlocks. So add a new RPCAUTH_LOOKUP flag for async lookups and don't block on memory. If the -ENOMEM gets back to call_refreshresult(), wait a short while and try again. HZ>>4 is chosen as it is used elsewhere for -ENOMEM retries. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
parent
c487216bec
commit
a41b05edfe
5 changed files with 21 additions and 3 deletions
|
@ -43,8 +43,14 @@ unx_destroy(struct rpc_auth *auth)
|
|||
static struct rpc_cred *
|
||||
unx_lookup_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
|
||||
{
|
||||
struct rpc_cred *ret = mempool_alloc(unix_pool, GFP_KERNEL);
|
||||
gfp_t gfp = GFP_KERNEL;
|
||||
struct rpc_cred *ret;
|
||||
|
||||
if (flags & RPCAUTH_LOOKUP_ASYNC)
|
||||
gfp = GFP_NOWAIT | __GFP_NOWARN;
|
||||
ret = mempool_alloc(unix_pool, gfp);
|
||||
if (!ret)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
rpcauth_init_cred(ret, acred, auth, &unix_credops);
|
||||
ret->cr_flags = 1UL << RPCAUTH_CRED_UPTODATE;
|
||||
return ret;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue