linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bixuan Cui <cuibixuan@linux.alibaba.com>
To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	linux-nfs@vger.kernel.org
Cc: cuibixuan@linux.alibaba.com, bfields@fieldses.org,
	chuck.lever@oracle.com, trond.myklebust@hammerspace.com,
	anna.schumaker@netapp.com, davem@davemloft.net, kuba@kernel.org,
	pete.wl@alibaba-inc.com, wenan.mwa@alibaba-inc.com,
	xiaoh.peixh@alibaba-inc.com, weipu.zy@alibaba-inc.com
Subject: [PATCH -next] SUNRPC: Clean XPRT_CONGESTED of xprt->state when rpc task is killed
Date: Tue, 14 Dec 2021 21:53:38 +0800	[thread overview]
Message-ID: <1639490018-128451-2-git-send-email-cuibixuan@linux.alibaba.com> (raw)
In-Reply-To: <1639490018-128451-1-git-send-email-cuibixuan@linux.alibaba.com>

When the values of tcp_max_slot_table_entries and
sunrpc.tcp_slot_table_entries are lower than the number of rpc tasks,
xprt_dynamic_alloc_slot() in xprt_alloc_slot() will return -EAGAIN, and
then set xprt->state to XPRT_CONGESTED:
  xprt_retry_reserve
    ->xprt_do_reserve
      ->xprt_alloc_slot
        ->xprt_dynamic_alloc_slot // return -EAGAIN and task->tk_rqstp is NULL
          ->xprt_add_backlog // set_bit(XPRT_CONGESTED, &xprt->state);

When rpc task is killed, XPRT_CONGESTED bit of xprt->state will not be
cleaned up and nfs hangs:
  rpc_exit_task
    ->xprt_release // if (req == NULL) is true, then XPRT_CONGESTED
		   // bit not clean

Add xprt_wake_up_backlog(xprt) to clean XPRT_CONGESTED bit in
xprt_release().

Signed-off-by: Bixuan Cui <cuibixuan@linux.alibaba.com>
Signed-off-by: Xiaohui Pei <xiaoh.peixh@alibaba-inc.com>
---
 net/sunrpc/xprt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index a02de2b..70d11ae 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -1952,6 +1952,7 @@ void xprt_release(struct rpc_task *task)
 	if (req == NULL) {
 		if (task->tk_client) {
 			xprt = task->tk_xprt;
+			xprt_wake_up_backlog(xprt);
 			xprt_release_write(xprt, task);
 		}
 		return;
-- 
1.8.3.1


  reply	other threads:[~2021-12-14 13:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-14 13:53 [PATCH -next] SUNRPC: Clean XPRT_CONGESTED of xprt->state when rpc task is killed Bixuan Cui
2021-12-14 13:53 ` Bixuan Cui [this message]
2021-12-20  3:39   ` Bixuan Cui
2021-12-20 18:22     ` Trond Myklebust
     [not found]       ` <efbf73f3-c6cd-90f6-ef22-bde14be708cc@linux.alibaba.com>
2021-12-22 15:02         ` Trond Myklebust
2021-12-31  2:00           ` Bixuan Cui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1639490018-128451-2-git-send-email-cuibixuan@linux.alibaba.com \
    --to=cuibixuan@linux.alibaba.com \
    --cc=anna.schumaker@netapp.com \
    --cc=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pete.wl@alibaba-inc.com \
    --cc=trond.myklebust@hammerspace.com \
    --cc=weipu.zy@alibaba-inc.com \
    --cc=wenan.mwa@alibaba-inc.com \
    --cc=xiaoh.peixh@alibaba-inc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).