From patchwork Fri Nov 10 22:37:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Watt X-Patchwork-Id: 10053897 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B19F66032D for ; Fri, 10 Nov 2017 22:37:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4958223C6 for ; Fri, 10 Nov 2017 22:37:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 98A5E2B4BB; Fri, 10 Nov 2017 22:37:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E889223C6 for ; Fri, 10 Nov 2017 22:37:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754716AbdKJWhf (ORCPT ); Fri, 10 Nov 2017 17:37:35 -0500 Received: from mail-io0-f195.google.com ([209.85.223.195]:53376 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754707AbdKJWhd (ORCPT ); Fri, 10 Nov 2017 17:37:33 -0500 Received: by mail-io0-f195.google.com with SMTP id 189so15099883iow.10 for ; Fri, 10 Nov 2017 14:37:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2AV4Xh4534gYV+mPa2hcXUQHl7vz6O10FcZ1d+7M2p0=; b=W2uyaZg2ftu3LJHV8j5WsZEYOz4avoR2Eqop18RDOCDckz6Tyz1gGuKbLkA0vHBBVl rhL+yn8KjUVf6/ftRVq+IYyHhuQjiBJY300YD+tnrT1gMeXlEMFzdknt7xqoSy+TA5LU BbBtJofMzrY2Z6tRl4oPd8WazkYEjGRD1BUsAE3sy7fg6Px0MvMC0k2PK4Bp7dThEum4 4bBWIXL/LBD3x/ygtAA27Rr5fsFbK1gjR0WGxNYmQEm4jzljOcmeNa6O4Vdq1KYd+GeI +YPZoBwbzMvLWlSsHGK23TXzEpHoQiEhc/RNISnlfUb/o63MbYN0AnUPIusl/JEOE/6M gUtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2AV4Xh4534gYV+mPa2hcXUQHl7vz6O10FcZ1d+7M2p0=; b=tdR5Ifi6Ud1g5o/fjXBTstVvRDc01qlLaFFrqAugDUGDVVeXcZID1IGbHJR2X0eOGu 2c8Rb+dhsGAa+mCmcbOjAzNrh68HliFGJTShZyAeRW0KLOhqua/qoLxSqZDPpSHLaKjo lfUIsEakBropK5KjfotwMgI4SxvaSx0FHWgrMndqGCIiqel/iTN77ZIuGDahpw/PlJN6 5yYcjpNNUiB10eYhY7iu2S2F9dH2+PLiDxn1oz2nj8Vu9zdRY38JUH37ibBpFzprItfR ynRa7vfLRo1zlnaVW20GyKCWWEyU6nso3jR7hUJYP0CVFzXSpD/phBBO2OYYT6DG+dN4 m4Dg== X-Gm-Message-State: AJaThX69BXlFNOy2tLoDhcjx4rmH3nmLDjXeuRdMcqcWtQmLsamHjRfk T+4uJQkFpyibQcFW6BBh5+g= X-Google-Smtp-Source: AGs4zMY1zr+3aa9f/dnMFFJFEADK98wuufaM1+uH7qR8zGKnwD+XKholzsOdGixslfvOnHXW050HYA== X-Received: by 10.107.104.12 with SMTP id d12mr2150614ioc.296.1510353453265; Fri, 10 Nov 2017 14:37:33 -0800 (PST) Received: from ola-842mrw1.ad.garmin.com ([204.77.163.55]) by smtp.googlemail.com with ESMTPSA id f3sm5001090iob.70.2017.11.10.14.37.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Nov 2017 14:37:32 -0800 (PST) From: Joshua Watt X-Google-Original-From: Joshua Watt To: NeilBrown , Jeff Layton , Trond Myklebust Cc: linux-nfs@vger.kernel.org, Al Viro , "J . Bruce Fields" , David Howells , Joshua Watt Subject: [RFC v2 1/7] SUNRPC: Add flag to kill new tasks Date: Fri, 10 Nov 2017 16:37:01 -0600 Message-Id: <20171110223707.17098-2-JPEWhacker@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171110223707.17098-1-JPEWhacker@gmail.com> References: <20171110223707.17098-1-JPEWhacker@gmail.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The flag causes any new tasks that are queued to exit immediately with -EIO instead of executing. This will allow clients (particularly NFS) to prevents these task from delaying shutdown of the RPC session longer than necessary. Signed-off-by: Joshua Watt --- include/linux/sunrpc/clnt.h | 1 + net/sunrpc/clnt.c | 3 --- net/sunrpc/sched.c | 3 +++ 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 71c237e8240e..94f4e464de1b 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h @@ -54,6 +54,7 @@ struct rpc_clnt { cl_noretranstimeo: 1,/* No retransmit timeouts */ cl_autobind : 1,/* use getport() */ cl_chatty : 1;/* be verbose */ + bool cl_kill_new_tasks; /* Kill all new tasks */ struct rpc_rtt * cl_rtt; /* RTO estimator data */ const struct rpc_timeout *cl_timeout; /* Timeout strategy */ diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index df4ecb042ebe..aa64cd667696 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -818,9 +818,6 @@ void rpc_killall_tasks(struct rpc_clnt *clnt) { struct rpc_task *rovr; - - if (list_empty(&clnt->cl_tasks)) - return; dprintk("RPC: killing all tasks for client %p\n", clnt); /* * Spin lock all_tasks to prevent changes... diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index 0cc83839c13c..2c9fe5c0319b 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c @@ -748,6 +748,9 @@ static void __rpc_execute(struct rpc_task *task) dprintk("RPC: %5u __rpc_execute flags=0x%x\n", task->tk_pid, task->tk_flags); + if (task->tk_client->cl_kill_new_tasks) + rpc_exit(task, -EIO); + WARN_ON_ONCE(RPC_IS_QUEUED(task)); if (RPC_IS_QUEUED(task)) return;