Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3748405pxv; Mon, 19 Jul 2021 07:52:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9snqNTDUovCv0XO3dTLhagbQwZyTh3rnIPSGLzxYkLiaV1vGQrXyp9e/9MrI8y9/N5ySX X-Received: by 2002:a05:6602:1203:: with SMTP id y3mr11993746iot.192.1626706366270; Mon, 19 Jul 2021 07:52:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626706366; cv=none; d=google.com; s=arc-20160816; b=n7cOo7XAPPIJNmrJpLcNmMhMglbT3ApHiA8Ynx6Gpln5sLdsRInyapXBXb5IFcPNKs 5hjxn8TDX+z6qyAT3yy3o/x7Iu9KL+NyLdciS/uickU5E7fcTstx/wvHuKh/6JdGyzhf WjqB7tT1eZzZ0dDqLkvMINBoeAwBLoKWs63RxGgWyB2/IWmOCg+DRqbEyfUruGjGkEsU MKzFIQwvLxIuqY2rIgMf3WOlFEmxTkB1SIfqU5DBlGkfUUGDXsWCdHEMERP0zXegNDqJ kisIt0Ami1ippQsbkd+feGnO/7ueSzI7pZI6WcbUOXVG3WnkAdIiTnaYwGGiJs6TkgL7 n0VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject; bh=gJU5FYYRPhD+C+dDLBQ9vi97vLWyJiFapsev63vKmjE=; b=a968NPHWTyis983bNTV7gRFrE1taYiflEsk7LDSVWPj3DDQ5Ou8qakXis1HLFX0f5R 9wNptRgDRPLCv5f3usFp7Y8ES8J8uuKs+F6nbft5hBsbPns44w5Gu6AqqTvPemTBRaFH qUL2JPbFAw/1WNUZQjFntFAGOmZDLhOyLokEj1TraDoXTayn6d1f8uHjJdZkU5a33wsc ZLmHMWp2JZttzqCilpBtnbe1x6gXWdFL4b/khd+99LMr3FfHxCVGXgKYsZ70Byj9GTKE gSZKusyScP17zDtYlFcfbyEorjIbrdIwN8T3gViyZZnPVsh01F1uHIvusGJVE9ODDPP3 O8fg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r9si12759518jap.26.2021.07.19.07.52.25; Mon, 19 Jul 2021 07:52:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232073AbhGSOLT (ORCPT + 99 others); Mon, 19 Jul 2021 10:11:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:40608 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241311AbhGSOI2 (ORCPT ); Mon, 19 Jul 2021 10:08:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D103F610F7; Mon, 19 Jul 2021 14:48:10 +0000 (UTC) Subject: [PATCH v2 2/6] SUNRPC: Unset RPC_TASK_NO_RETRANS_TIMEOUT for NULL RPCs From: Chuck Lever To: trondmy@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Date: Mon, 19 Jul 2021 10:48:10 -0400 Message-ID: <162670609014.468132.12141390010470960903.stgit@manet.1015granger.net> In-Reply-To: <162670594361.468132.16222376053830760696.stgit@manet.1015granger.net> References: <162670594361.468132.16222376053830760696.stgit@manet.1015granger.net> User-Agent: StGit/1.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org In some rare failure modes, the server is actually reading the transport, but then just dropping the requests on the floor. TCP_USER_TIMEOUT cannot detect that case. Prevent such a stuck server from pinning client resources indefinitely by ensuring that certain idempotent requests (such as NULL) can time out even if the connection is still operational. Otherwise rpc_bind_new_program(), gss_destroy_cred(), or rpc_clnt_test_and_add_xprt() can wait forever. Signed-off-by: Chuck Lever --- net/sunrpc/clnt.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index ca2000d8cf64..d34737a8a68a 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -2694,6 +2694,18 @@ static const struct rpc_procinfo rpcproc_null = { .p_decode = rpcproc_decode_null, }; +static void +rpc_null_call_prepare(struct rpc_task *task, void *data) +{ + task->tk_flags &= ~RPC_TASK_NO_RETRANS_TIMEOUT; + rpc_call_start(task); +} + +static const struct rpc_call_ops rpc_null_ops = { + .rpc_call_prepare = rpc_null_call_prepare, + .rpc_call_done = rpc_default_callback, +}; + static struct rpc_task *rpc_call_null_helper(struct rpc_clnt *clnt, struct rpc_xprt *xprt, struct rpc_cred *cred, int flags, @@ -2707,7 +2719,7 @@ struct rpc_task *rpc_call_null_helper(struct rpc_clnt *clnt, .rpc_xprt = xprt, .rpc_message = &msg, .rpc_op_cred = cred, - .callback_ops = (ops != NULL) ? ops : &rpc_default_ops, + .callback_ops = ops ?: &rpc_null_ops, .callback_data = data, .flags = flags | RPC_TASK_SOFT | RPC_TASK_SOFTCONN | RPC_TASK_NULLCREDS, @@ -2758,6 +2770,7 @@ static void rpc_cb_add_xprt_release(void *calldata) } static const struct rpc_call_ops rpc_cb_add_xprt_call_ops = { + .rpc_call_prepare = rpc_null_call_prepare, .rpc_call_done = rpc_cb_add_xprt_done, .rpc_release = rpc_cb_add_xprt_release, };