From patchwork Fri Jun 3 12:08:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mkrtchyan, Tigran" X-Patchwork-Id: 9152959 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 68D4260221 for ; Fri, 3 Jun 2016 12:09:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 597992804C for ; Fri, 3 Jun 2016 12:09:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E25E28328; Fri, 3 Jun 2016 12:09:00 +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.9 required=2.0 tests=BAYES_00,HK_RANDOM_FROM, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY 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 A23492804C for ; Fri, 3 Jun 2016 12:08:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932634AbcFCMI6 (ORCPT ); Fri, 3 Jun 2016 08:08:58 -0400 Received: from smtp-o-3.desy.de ([131.169.56.156]:42760 "EHLO smtp-o-3.desy.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932593AbcFCMI5 (ORCPT ); Fri, 3 Jun 2016 08:08:57 -0400 X-Clacks-Overhead: GNU Terry Pratchett Received: from smtp-map-3.desy.de (smtp-map-3.desy.de [131.169.56.68]) by smtp-o-3.desy.de (DESY-O-3) with ESMTP id 5AAE52808A9 for ; Fri, 3 Jun 2016 14:08:55 +0200 (CEST) Received: from ZITSWEEP1.win.desy.de (zitsweep1.win.desy.de [131.169.97.95]) by smtp-map-3.desy.de (DESY_MAP_3) with ESMTP id 4E6601391 for ; Fri, 3 Jun 2016 14:08:54 +0200 (MEST) Received: from smtp-intra-3.desy.de (lb-40-26.desy.de) by ZITSWEEP1.win.desy.de (Clearswift SMTPRS 5.5.0) with ESMTP id ; Fri, 3 Jun 2016 14:08:55 +0200 Received: from anahit.desy.de (anahit.desy.de [131.169.185.68]) by smtp-intra-3.desy.de (DESY-INTRA-3) with ESMTP id B27E81391; Fri, 3 Jun 2016 14:08:54 +0200 (MEST) From: Tigran Mkrtchyan To: linux-nfs@vger.kernel.org Cc: Yves Kemp , Trond Myklebust , Tigran Mkrtchyan Subject: [PATCH] nfs4: clnt: respect noresvport when establishing connections to DSes Date: Fri, 3 Jun 2016 14:08:43 +0200 Message-Id: <1464955723-4678-1-git-send-email-tigran.mkrtchyan@desy.de> X-Mailer: git-send-email 2.5.5 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 tcp 0 0 131.169.185.68:34894 131.169.191.141:32049 ESTABLISHED tcp 0 0 131.169.185.68:35722 131.169.191.144:2049 ESTABLISHED tcp 0 0 131.169.185.68:1005 131.169.191.141:32049 ESTABLISHED tcp 0 0 131.169.185.68:751 131.169.191.144:2049 ESTABLISHED Signed-off-by: Tigran Mkrtchyan --- fs/nfs/internal.h | 1 + fs/nfs/nfs4client.c | 5 ++++- fs/nfs/pnfs_nfs.c | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 5154fa6..e8b2192 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -185,6 +185,7 @@ extern struct nfs_server *nfs_clone_server(struct nfs_server *, extern int nfs_wait_client_init_complete(const struct nfs_client *clp); extern void nfs_mark_client_ready(struct nfs_client *clp, int state); extern struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp, + int noresvport, const struct sockaddr *ds_addr, int ds_addrlen, int ds_proto, unsigned int ds_timeo, diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index 10410e8..6cfb5f9 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c @@ -842,7 +842,7 @@ error: * low timeout interval so that if a connection is lost, we retry through * the MDS. */ -struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp, +struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp, int noresvport, const struct sockaddr *ds_addr, int ds_addrlen, int ds_proto, unsigned int ds_timeo, unsigned int ds_retrans, u32 minor_version, rpc_authflavor_t au_flavor) @@ -863,6 +863,9 @@ struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp, return ERR_PTR(-EINVAL); cl_init.hostname = buf; + if (noresvport) + set_bit(NFS_CS_NORESVPORT, &cl_init.init_flags); + /* * Set an authflavor equual to the MDS value. Use the MDS nfs_client * cl_ipaddr so as to use the same EXCHANGE_ID co_ownerid as the MDS diff --git a/fs/nfs/pnfs_nfs.c b/fs/nfs/pnfs_nfs.c index 0dfc476..b4ac66d 100644 --- a/fs/nfs/pnfs_nfs.c +++ b/fs/nfs/pnfs_nfs.c @@ -8,6 +8,7 @@ */ #include +#include #include #include #include @@ -683,6 +684,7 @@ static int _nfs4_pnfs_v4_ds_connect(struct nfs_server *mds_srv, __func__, ds->ds_remotestr, da->da_remotestr); clp = nfs4_set_ds_client(mds_srv->nfs_client, + mds_srv->flags & NFS_MOUNT_NORESVPORT ? 1 : 0, (struct sockaddr *)&da->da_addr, da->da_addrlen, IPPROTO_TCP, timeo, retrans, minor_version,