Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2454857rdb; Fri, 8 Dec 2023 08:34:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IEAeHeGKmSdgnq8GefXKBhSxYtgYPBQUfcW9ArW3Qa72A/mHhtFHuiwfHG29bVfzoKyRrQx X-Received: by 2002:a05:6a00:2388:b0:6cd:f365:826d with SMTP id f8-20020a056a00238800b006cdf365826dmr314499pfc.6.1702053245406; Fri, 08 Dec 2023 08:34:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702053245; cv=none; d=google.com; s=arc-20160816; b=H1nT2iisS9OGFrDQHjYi1xNAjHSxy+B834tuJEsSJf7vI8LNvEivhm5EJBd+9KdQDb wyQqvYjFAZyzSptnAu4KGtH/T8bODJszWi/V/SZC39dL8WgACTaDJXIEJlFWlcIcwnGv 4k6pXSynckpZRlqBwx/S8jGSDq1q+X6kis3fAW5Euv4Q6bU4Z8EmWaTdOtTgdYPLzX4K CvSqAczhIbYCVc8hbxF0Q+gQHdRyppJ5Dqyk583yPuDSKy5bNocWTetOkVPiTj5vPKqu hbI4MsCPAT3qjjrsf0yR8/YorTeL42fkdvwrOo+sTE/DSkIhfqelLNHFIE178ynzuICK HH0Q== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=y4TVLto5yau0RPKvE5rj0WXkhDHoLDKrreZTCT+40mI=; fh=kMe8ipV+H2zZMCwplNV8b/uzUHICYp+b9TeU6KoaKrQ=; b=VdCA4wK9GwzZ+Du0X3oJsra6RsRnHL4RaBc3C4y0lcgX2VI+ww7nNeKbQ8wzH+B6qD uuB7Sag7INuwlJSH4J1iNSU+krautR0Po/kG+eEUzceoSV+daAl6FnpvxBA7XeRqSfI0 Q/by8Kn4SKTl/R+krDl6bm+HfTd9gezww448O/asF6IAmRRd1dQDvHz+JDbB4aiaXA2D PlZrxtx63EYhZ/hTu48dm07KdyRmsjnDqcZIi3G5g+yd7xRbinMTB3KS/zCGf5qvVntR R3HHVifwXQfxAv59YHn1phAsQkbK03tT+RgIoR5zLYJ194YJ0GIHiQcuNpMCBMEpacs4 oH0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CXVFKVWG; spf=pass (google.com: domain of linux-nfs+bounces-469-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-nfs+bounces-469-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x34-20020a056a0018a200b006ce9b9901e3si1785163pfh.156.2023.12.08.08.34.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 08:34:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-469-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CXVFKVWG; spf=pass (google.com: domain of linux-nfs+bounces-469-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-nfs+bounces-469-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 171D4281802 for ; Fri, 8 Dec 2023 16:34:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2189938DF6; Fri, 8 Dec 2023 16:34:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CXVFKVWG" X-Original-To: linux-nfs@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBF1B199E for ; Fri, 8 Dec 2023 08:33:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702053235; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=y4TVLto5yau0RPKvE5rj0WXkhDHoLDKrreZTCT+40mI=; b=CXVFKVWGl5HYvzQKju05soTNg2RGgrIg1bn7KayglQKzUNmhFMVoLvtKeKAX7gYAEno7I2 D6BK2R55ebwAkMnLRws63YQi8R/lG8yyc2ZqFBs3iQvO+YOk2i5TE/XfqZxH5XPybYR8R2 NUQ2TKywRgBDfgFK0S/EGiqcdC3KO0M= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-323-KirhAhM-M5CSnv9hnaCBAw-1; Fri, 08 Dec 2023 11:33:53 -0500 X-MC-Unique: KirhAhM-M5CSnv9hnaCBAw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (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 BEA388F5DA8; Fri, 8 Dec 2023 16:33:52 +0000 (UTC) Received: from bcodding.csb.redhat.com (unknown [10.22.48.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 627AB1C060AF; Fri, 8 Dec 2023 16:33:52 +0000 (UTC) From: Benjamin Coddington To: trond.myklebust@hammerspace.com, anna@kernel.org Cc: linux-nfs@vger.kernel.org Subject: [PATCH] SUNRPC: Fixup v4.1 backchannel request timeouts Date: Fri, 8 Dec 2023 11:33:51 -0500 Message-ID: Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 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 (to->to_exponential) majortimeo <<= to->to_retries; else @@ -686,7 +691,11 @@ static void xprt_init_majortimeo(struct rpc_task *task, struct rpc_rqst *req) time_init = jiffies; else time_init = xprt_abs_ktime_to_jiffies(task->tk_start); - req->rq_timeout = task->tk_client->cl_timeout->to_initval; + + if (task->tk_client) + req->rq_timeout = task->tk_client->cl_timeout->to_initval; + else + req->rq_timeout = req->rq_xprt->bc_timeout.to_initval; req->rq_majortimeo = time_init + xprt_calc_majortimeo(req); req->rq_minortimeo = time_init + req->rq_timeout; } @@ -1998,6 +2007,8 @@ xprt_init_bc_request(struct rpc_rqst *req, struct rpc_task *task) */ xbufp->len = xbufp->head[0].iov_len + xbufp->page_len + xbufp->tail[0].iov_len; + + xprt_init_majortimeo(task, req); } #endif -- 2.43.0