From patchwork Fri Dec 21 17:35:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Averin X-Patchwork-Id: 10740775 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 16E23924 for ; Fri, 21 Dec 2018 17:35:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03F09284CE for ; Fri, 21 Dec 2018 17:35:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA9CE285CD; Fri, 21 Dec 2018 17:35:27 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 9D1BC284CE for ; Fri, 21 Dec 2018 17:35:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732977AbeLURf1 (ORCPT ); Fri, 21 Dec 2018 12:35:27 -0500 Received: from relay.sw.ru ([185.231.240.75]:40888 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730364AbeLURf1 (ORCPT ); Fri, 21 Dec 2018 12:35:27 -0500 Received: from [172.16.24.21] by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1gaOho-0004ut-MH; Fri, 21 Dec 2018 20:35:24 +0300 From: Vasily Averin Subject: [PATCH v3 3/8] sunrpc: introduce per-netns sunrpc_net->bc_prep_reply_hdr() To: Trond Myklebust , Anna Schumaker Cc: "J. Bruce Fields" , Jeff Layton , Chuck Lever , linux-nfs@vger.kernel.org, Evgenii Shatokhin References: Message-ID: <457b3440-bcbb-2af4-65e7-8af75ef7be32@virtuozzo.com> Date: Fri, 21 Dec 2018 20:35:23 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US 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 Currently svc_process_common() uses quite complex schema to adjust reply header, only required for tcp transports. This patch adds an alternative way to access required function: function pointer is added into per-netns sunrpc_net structure during creation of back channel svc_xprt. Signed-off-by: Vasily Averin --- net/sunrpc/netns.h | 2 ++ net/sunrpc/svc_xprt.c | 5 +++++ net/sunrpc/svcsock.c | 3 +++ 3 files changed, 10 insertions(+) diff --git a/net/sunrpc/netns.h b/net/sunrpc/netns.h index 7ec10b92bea1..ff067107e4f7 100644 --- a/net/sunrpc/netns.h +++ b/net/sunrpc/netns.h @@ -6,6 +6,7 @@ #include struct cache_detail; +struct svc_rqst; struct sunrpc_net { struct proc_dir_entry *proc_net_rpc; @@ -33,6 +34,7 @@ struct sunrpc_net { int pipe_version; atomic_t pipe_users; struct proc_dir_entry *use_gssp_proc; + void (*bc_prep_reply_hdr)(struct svc_rqst *); }; extern unsigned int sunrpc_net_id; diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index 51d36230b6e3..2ffeecfa0978 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c @@ -19,6 +19,8 @@ #include #include +#include "netns.h" + #define RPCDBG_FACILITY RPCDBG_SVCXPRT static unsigned int svc_rpc_per_connection_limit __read_mostly; @@ -134,8 +136,11 @@ static void svc_xprt_free(struct kref *kref) struct svc_xprt *xprt = container_of(kref, struct svc_xprt, xpt_ref); struct module *owner = xprt->xpt_class->xcl_owner; + struct sunrpc_net *sn = net_generic(xprt->xpt_net, sunrpc_net_id); + if (test_bit(XPT_CACHE_AUTH, &xprt->xpt_flags)) svcauth_unix_info_release(xprt); + sn->bc_prep_reply_hdr = NULL; put_net(xprt->xpt_net); /* See comment on corresponding get in xs_setup_bc_tcp(): */ if (xprt->xpt_bc_xprt) diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 986f3ed7d1a2..7c0f9439f94c 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c @@ -55,6 +55,7 @@ #include #include "sunrpc.h" +#include "netns.h" #define RPCDBG_FACILITY RPCDBG_SVCXPRT @@ -1608,6 +1609,7 @@ static struct svc_xprt *svc_bc_create_socket(struct svc_serv *serv, { struct svc_sock *svsk; struct svc_xprt *xprt; + struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); if (protocol != IPPROTO_TCP) { printk(KERN_WARNING "svc: only TCP sockets" @@ -1623,6 +1625,7 @@ static struct svc_xprt *svc_bc_create_socket(struct svc_serv *serv, svc_xprt_init(net, &svc_tcp_bc_class, xprt, serv); set_bit(XPT_CONG_CTRL, &svsk->sk_xprt.xpt_flags); + sn->bc_prep_reply_hdr = svc_tcp_prep_reply_hdr; serv->sv_bc_xprt = xprt; return xprt;