From patchwork Tue Nov 14 23:06:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Watt X-Patchwork-Id: 10058535 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 C2EC26056E for ; Tue, 14 Nov 2017 23:06:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5D8A29AAD for ; Tue, 14 Nov 2017 23:06:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA97829AB2; Tue, 14 Nov 2017 23:06:39 +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 460D529AAD for ; Tue, 14 Nov 2017 23:06:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756458AbdKNXGi (ORCPT ); Tue, 14 Nov 2017 18:06:38 -0500 Received: from mail-io0-f195.google.com ([209.85.223.195]:43388 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753449AbdKNXGh (ORCPT ); Tue, 14 Nov 2017 18:06:37 -0500 Received: by mail-io0-f195.google.com with SMTP id 134so26208328ioo.0 for ; Tue, 14 Nov 2017 15:06:36 -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=VlxjtBaG8suzA6IvL9Y7S23b93qbt+/l6DDLH54N+TM=; b=oFJ6qMM7NYfdoZXla6j/bscHH5AS4Sgc0ijx6ptwWXVIjD2VRdlXk+OLlwaFEmc8I0 XWjyOGaDo2qZcZyKlyNMKh83NqcOq+b9F0CE4I7cDka3CmeucDk/PjISHA/ZujYywjoN JLD4Kz3cniLQDyn2huhzeOuWxYh21rZrWexxe6fFyPj1ASH9vn/JuaYV5gT6ow48czm0 CkrYBi7PiuzwqYln4t8LTC2qoK2STA52qdIy7IXoV4PSGyx5qPlRdSETlGlb0OZxa2KV F1FlFIX/cYot+tXbKuOwM4zwdYrtSFzwM40H5QCNNI8gTMAPuBovr0i7UwjQibkqXffT pvIg== 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=VlxjtBaG8suzA6IvL9Y7S23b93qbt+/l6DDLH54N+TM=; b=DEKnHaNSFJXMJUm0v/q6zj/Xe3ab70aL6DjAJZWUuOtmv2N3RD64+paqhMyon3ZoFW NNeO4xRfTjCoYg02pHFIQSJh+19vPjY1ZWwpCX6kACfk3TXDKIKoYUtGX+aEAhz2PMen yZ2e9AhEuaXB2aQ1DYUusp2HbwclSwJ2VOljq14nv0NGUyJg1kWGC+u+Qnplb6VvC+cN GWcHybjsLWceu/Uw2Jg8flILDSlC0/LreUWyAZEDCogERg+uIRGZEMR1SBJnwEW7E6F4 ZmNbMIQqWRR8H+DrVtL7VLzZRcDqpsEjTRsQxcJkQvMmXT+jdPc6ihlDD7Z2qeMnzSWn LUAg== X-Gm-Message-State: AJaThX6T2BA6sWOnow4LHJdPrw0oWRqinI8LcH1RZUb+gJKdqhbcYgNJ 1eH8G2thS7n96EGMb/qQWaY= X-Google-Smtp-Source: AGs4zMbFrUFCsTrZFlISopNdl9+wmUQM5iXnktoXNG7257dP83AMb3NYHnw4wg6iCBI2bpP84UeJMQ== X-Received: by 10.107.47.133 with SMTP id v5mr15407017iov.22.1510700796254; Tue, 14 Nov 2017 15:06:36 -0800 (PST) Received: from ola-842mrw1.ad.garmin.com ([204.77.163.55]) by smtp.googlemail.com with ESMTPSA id e203sm6015236itb.32.2017.11.14.15.06.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 Nov 2017 15:06:35 -0800 (PST) From: Joshua Watt X-Google-Original-From: Joshua Watt To: NeilBrown , Jeff Layton , Trond Myklebust , "J . Bruce Fields" Cc: linux-nfs@vger.kernel.org, Al Viro , David Howells , Joshua Watt Subject: [RFC v3 1/7] SUNRPC: Add flag to kill new tasks Date: Tue, 14 Nov 2017 17:06:25 -0600 Message-Id: <20171114230631.14682-2-JPEWhacker@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171114230631.14682-1-JPEWhacker@gmail.com> References: <20171114230631.14682-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 | 4 +--- net/sunrpc/sched.c | 3 +++ 3 files changed, 5 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..ab6b7c59a117 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -626,6 +626,7 @@ static struct rpc_clnt *__rpc_clone_client(struct rpc_create_args *args, new->cl_noretranstimeo = clnt->cl_noretranstimeo; new->cl_discrtry = clnt->cl_discrtry; new->cl_chatty = clnt->cl_chatty; + new->cl_kill_new_tasks = clnt->cl_kill_new_tasks; return new; out_err: @@ -818,9 +819,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;