Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2545175rdb; Fri, 8 Dec 2023 11:08:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IF7Xq8GerEPXQnzn29dhn7mszzSQlYde7ftWkFIVmEU6DGjhygY7I30taDY7Nbp5ndNxZHu X-Received: by 2002:a17:907:904d:b0:a1c:d54f:9f19 with SMTP id az13-20020a170907904d00b00a1cd54f9f19mr193818ejc.53.1702062494190; Fri, 08 Dec 2023 11:08:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702062494; cv=none; d=google.com; s=arc-20160816; b=M4t5frjwepFNTtYaYo/XF7iEbkkD0usgjovc9lkKLzIuTX7ifhz4x/eAiulXcGQPpo R4hbg8wjx8s1vPXrTA2T6e/clF8MeADn4cyFA96Xsff4LTnv2rGy7SbO0RWnBWhjoS7x ASAqIoIZypE8CFvfJ8faPF0tXgnYaU43GZliMPTWKCMSu1YYIUwvOYXNz1wnNkxkyNNz /z4JaDDdvx+EF0v/BadrAXMgnU739vQFK/mSK5lNGwGMQmncYCc6ceAPAg6dKuxFwkjh N/MTWe46H25fFkP2b9QWXGB0VlpbJWl4dEA9g+rx6d6MveELyED6+No3ajULMUqIsapQ jCiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=kMcGFasePBvzFgsjvrxP1IuuCfq1PJHsMXAvC4CYFCg=; fh=G3i7fV6Ga7RyV8q6svsk25rDlrjMVX5rvyYwPUiOvf8=; b=XVNqIne7XC+n2SQ9MfpUl6I2VkGh9OsIPWsOZ5UKx7ho3qP7wwqNGxwUq8eiHGn6lI gmrXOWkAI1wmN730fDTHMAL1glOYUAa5I7yvVRGS+acPjhhh7tsqh6qDcKW2gt2dV3Co 6E9o77AiG5Xgg5TNjUxBC/XQhst4F6st+FdnBt1qS7jGj3AGPd2CZl2JhxlX9r8BJeyJ xbwv9fPb0nGlG/f5znOBumrYdso8B8MfHGJ7Kevf3JxBU5ybEtLjqV1Yv5Qo1j4GiEST zCoLER9v/LlAsb1FFM6JlHnxQf3YuypmhYq/R+8VuUdJOqKNnDR7jQnRn9IO6TiRfbBl BekA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HtRzBnQj; spf=pass (google.com: domain of linux-nfs+bounces-472-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-nfs+bounces-472-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id kk26-20020a170907767a00b00a1e7be8955asi1013871ejc.738.2023.12.08.11.08.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 11:08:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-472-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HtRzBnQj; spf=pass (google.com: domain of linux-nfs+bounces-472-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-nfs+bounces-472-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DF40B1F21093 for ; Fri, 8 Dec 2023 19:08:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DB6C141C80; Fri, 8 Dec 2023 19:08:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HtRzBnQj" X-Original-To: linux-nfs@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D42E84 for ; Fri, 8 Dec 2023 11:08:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702062486; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kMcGFasePBvzFgsjvrxP1IuuCfq1PJHsMXAvC4CYFCg=; b=HtRzBnQjrnz5KCaNotZvE/In1fa1RkrwSbNGjgPqv2MEfD4nLuV1a5t/2MJPnhV3efPJId +Psan7fRQEYan7gGzrmSpsRX+qKCT3ZojNO9efHEi5IO/FkjY4GIeJG487rB3GksAbSlIT 3SGyZrfx3v98zSzFJvK3r0hmNs+ksl8= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-186-N2Gh1fn3On2pHK-2KiP7ig-1; Fri, 08 Dec 2023 14:08:05 -0500 X-MC-Unique: N2Gh1fn3On2pHK-2KiP7ig-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 22BFB1C068EC; Fri, 8 Dec 2023 19:08:05 +0000 (UTC) Received: from [100.85.132.103] (unknown [10.22.48.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 80B5840C6EB9; Fri, 8 Dec 2023 19:08:04 +0000 (UTC) From: Benjamin Coddington To: Trond Myklebust Cc: anna@kernel.org, linux-nfs@vger.kernel.org Subject: Re: [PATCH] SUNRPC: Fixup v4.1 backchannel request timeouts Date: Fri, 08 Dec 2023 14:08:03 -0500 Message-ID: In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 On 8 Dec 2023, at 13:16, Trond Myklebust wrote: > On Fri, 2023-12-08 at 11:33 -0500, Benjamin Coddington wrote: >> After commit 59464b262ff5 ("SUNRPC: SOFTCONN tasks should time out >> when on >> the sending list"), any 4.1 backchannel tasks placed on the sending >> queue >> would immediately return with -ETIMEDOUT since their req timers are >> zero. >> We can fix this by keeping a copy of the rpc_clnt's timeout params on >> the >> transport and using them to properly setup the timeouts on the v4.1 >> backchannel tasks' req. >> >> Fixes: 59464b262ff5 ("SUNRPC: SOFTCONN tasks should time out when on >> the sending list") >> Signed-off-by: Benjamin Coddington >> --- >>  include/linux/sunrpc/xprt.h |  1 + >>  net/sunrpc/clnt.c           |  3 +++ >>  net/sunrpc/xprt.c           | 15 +++++++++++++-- >>  3 files changed, 17 insertions(+), 2 deletions(-) >> >> diff --git a/include/linux/sunrpc/xprt.h >> b/include/linux/sunrpc/xprt.h >> index f85d3a0daca2..7565902053f3 100644 >> --- a/include/linux/sunrpc/xprt.h >> +++ b/include/linux/sunrpc/xprt.h >> @@ -285,6 +285,7 @@ struct rpc_xprt { >>   * items */ >>   struct list_head bc_pa_list; /* List of >> preallocated >>   * backchannel >> rpc_rqst's */ >> + struct rpc_timeout bc_timeout; /* backchannel >> timeout params */ >>  #endif /* CONFIG_SUNRPC_BACKCHANNEL */ >>   >>   struct rb_root recv_queue; /* Receive queue */ >> diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c >> index d6805c1268a7..5891757c88b1 100644 >> --- a/net/sunrpc/clnt.c >> +++ b/net/sunrpc/clnt.c >> @@ -279,6 +279,9 @@ static struct rpc_xprt >> *rpc_clnt_set_transport(struct rpc_clnt *clnt, >>   clnt->cl_autobind = 1; >>   >>   clnt->cl_timeout = timeout; >> +#if defined(CONFIG_SUNRPC_BACKCHANNEL) >> + memcpy(&xprt->bc_timeout, timeout, sizeof(struct >> rpc_timeout)); >> +#endif >>   rcu_assign_pointer(clnt->cl_xprt, xprt); >>   spin_unlock(&clnt->cl_lock); >>   >> diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c >> index 92301e32cda4..d9cbe0814fd8 100644 >> --- a/net/sunrpc/xprt.c >> +++ b/net/sunrpc/xprt.c >> @@ -655,9 +655,14 @@ static unsigned long >> xprt_abs_ktime_to_jiffies(ktime_t abstime) >>   >>  static unsigned long xprt_calc_majortimeo(struct rpc_rqst *req) >>  { >> - const struct rpc_timeout *to = req->rq_task->tk_client- >>> cl_timeout; >> + const struct rpc_timeout *to; >>   unsigned long majortimeo = req->rq_timeout; >>   >> + if (req->rq_task->tk_client) >> + to = req->rq_task->tk_client->cl_timeout; >> + else >> + to = &req->rq_xprt->bc_timeout; >> > > If you're going to convert this function for generic use, then please > pass the timeout 'to' as a function parameter rather than making > assumptions here. No problem, I'll send it, but we'll end needing to make the same assumption calling xprt_reset_majortimeo() from xprt_adjust_timeout(). .. actually it looks like backchannel tasks never currently call rpc_check_timeout(), so we could just send the rpc_client's rpc_timeout there, but that looks like a potential future problem. I'll send a v2 that way and kick off my testing again. I always thought that NULL tk_client was definitively backchannel. Is there a case you're worried about? We can fix this another way, probably. Looks like this fix won't actually end up implementing normal timeout processing without adding rpc_check_timeout() calls to the backchannel's tk_actions. Ben