From patchwork Fri Nov 10 22:37:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Watt X-Patchwork-Id: 10053907 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 04F5C6032D for ; Fri, 10 Nov 2017 22:37:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECE27223C6 for ; Fri, 10 Nov 2017 22:37:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1BC32B4CD; Fri, 10 Nov 2017 22:37:42 +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 5B77E223C6 for ; Fri, 10 Nov 2017 22:37:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754707AbdKJWhk (ORCPT ); Fri, 10 Nov 2017 17:37:40 -0500 Received: from mail-it0-f66.google.com ([209.85.214.66]:53593 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754725AbdKJWhi (ORCPT ); Fri, 10 Nov 2017 17:37:38 -0500 Received: by mail-it0-f66.google.com with SMTP id m191so3393145itg.2 for ; Fri, 10 Nov 2017 14:37:37 -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=EYKK23pcsdHXSDVkidyRORt8OZQEQ2EqfSV5O8LytUw=; b=uvqXH/L2dNM0ldaeZbx66H0LClRD8nhA4iyIWX1WUCL0AIBOytL6c7Xxi4H829RSuo BKt5eNk8nQvZiAHHZsMF/EyHepJLN9nknJTLSVEOO+y4C6Bdjz7I+BW5ZFNer2noWX3o ZcCkIpY0jhno/AYuE3SlIBZb6HfbCLAiMX51Gcz6zEl5xblcm+NeoHUYI8LLkQs4H/2b cXQ7ZhGN38n+E7srA9SfCXnf0fl3kqXAHlTO+QjJ9yuoIW3mAN/yMahNTbGULhcW48Zs uOmDpFy+IzSpiJ5JSuyoww8o2PHQUN3LqGdfE1OuIzmjFGPuICLXkyP2q+YLj+vH0SYI Gz4w== 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=EYKK23pcsdHXSDVkidyRORt8OZQEQ2EqfSV5O8LytUw=; b=GNyMoPxB/KarmKup3vmD1kVKb63mAwc0BdPR/UNNEZsO4nehR1LUjjM51l2mvb4Oq2 aEh4s+2+Rd3lZUJVrZ5Ul3fykGYAqMvYVcUWPWs8ngHZu9Xd+5fG1PDAIs5FMOQyeDf/ 69PqPClMcZMyI3NMZokDVxJdcMkH8bfv7StEZx7Nwe0cHJJWwEtwEiwVXxiFWVnhWRPB ojxnfJtMQnIKVDsQVEl6GteoGHIDDAsdjX1rCEQE/t0T96PFv7gldi9EpyWx9Ck0Epz1 Dk2iYJmWvCZjOLb5KWcJKYVgbVC/lmYpfHHayg8fWEMSJSYCIw5d6ONA4pRCNuIHejoI ELuw== X-Gm-Message-State: AJaThX5kyhpwTpAFVN2cLQK+mIjkBvAPlYQwaeMJtWJWY/oO4xkcEMkG BBsa3mZKMSBfaLJoUmAcskE= X-Google-Smtp-Source: AGs4zMbBJctdmwNXSK8dygKQtZAY3zskEebJ4qs4n3DZ/JQNi0Zbe2CGCKikANFZA0/TbGHUGvtv/g== X-Received: by 10.36.104.211 with SMTP id v202mr2426497itb.153.1510353457486; Fri, 10 Nov 2017 14:37:37 -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.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Nov 2017 14:37:37 -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 6/7] NFS: Propagate NFS_MOUNT_UNSHARED to clients Date: Fri, 10 Nov 2017 16:37:06 -0600 Message-Id: <20171110223707.17098-7-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 Propagating the flag allows operations to be performed on the client without affecting other mounts to the same client, much like operations on the superblock will not affect other superblocks. Signed-off-by: Joshua Watt --- fs/nfs/client.c | 9 +++++++-- fs/nfs/nfs3client.c | 2 ++ fs/nfs/nfs4client.c | 4 ++++ include/linux/nfs_fs_sb.h | 1 + 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 22880ef6d8dd..c5872286f322 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -297,6 +297,10 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat if (clp->cl_cons_state < 0) continue; + /* Don't match clients that don't want to be shared */ + if (test_bit(NFS_CS_UNSHARED, &clp->cl_flags)) + continue; + /* Different NFS versions cannot share the same nfs_client */ if (clp->rpc_ops != data->nfs_mod->rpc_ops) continue; @@ -386,7 +390,7 @@ nfs_found_client(const struct nfs_client_initdata *cl_init, */ struct nfs_client *nfs_get_client(const struct nfs_client_initdata *cl_init) { - struct nfs_client *clp, *new = NULL; + struct nfs_client *clp = NULL, *new = NULL; struct nfs_net *nn = net_generic(cl_init->net, nfs_net_id); const struct nfs_rpc_ops *rpc_ops = cl_init->nfs_mod->rpc_ops; @@ -399,7 +403,8 @@ struct nfs_client *nfs_get_client(const struct nfs_client_initdata *cl_init) do { spin_lock(&nn->nfs_client_lock); - clp = nfs_match_client(cl_init); + if (!test_bit(NFS_CS_UNSHARED, &cl_init->init_flags)) + clp = nfs_match_client(cl_init); if (clp) { spin_unlock(&nn->nfs_client_lock); if (new) diff --git a/fs/nfs/nfs3client.c b/fs/nfs/nfs3client.c index 7879f2a0fcfd..b62bed41053f 100644 --- a/fs/nfs/nfs3client.c +++ b/fs/nfs/nfs3client.c @@ -102,6 +102,8 @@ struct nfs_client *nfs3_set_ds_client(struct nfs_server *mds_srv, if (mds_srv->flags & NFS_MOUNT_NORESVPORT) set_bit(NFS_CS_NORESVPORT, &cl_init.init_flags); + if (mds_srv->flags & NFS_MOUNT_UNSHARED) + __set_bit(NFS_CS_UNSHARED, &cl_init.init_flags); /* Use the MDS nfs_client cl_ipaddr. */ nfs_init_timeout_values(&ds_timeout, ds_proto, ds_timeo, ds_retrans); diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index e9bea90dc017..e51467f5b3bc 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c @@ -852,6 +852,8 @@ static int nfs4_set_client(struct nfs_server *server, set_bit(NFS_CS_MIGRATION, &cl_init.init_flags); if (test_bit(NFS_MIG_TSM_POSSIBLE, &server->mig_status)) set_bit(NFS_CS_TSM_POSSIBLE, &cl_init.init_flags); + if (server->flags & NFS_MOUNT_UNSHARED) + __set_bit(NFS_CS_UNSHARED, &cl_init.init_flags); /* Allocate or find a client reference we can use */ clp = nfs_get_client(&cl_init); @@ -910,6 +912,8 @@ struct nfs_client *nfs4_set_ds_client(struct nfs_server *mds_srv, if (mds_srv->flags & NFS_MOUNT_NORESVPORT) __set_bit(NFS_CS_NORESVPORT, &cl_init.init_flags); + if (mds_srv->flags & NFS_MOUNT_UNSHARED) + __set_bit(NFS_CS_UNSHARED, &cl_init.init_flags); /* * Set an authflavor equual to the MDS value. Use the MDS nfs_client diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index 286b71c418b4..8761f729921a 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h @@ -44,6 +44,7 @@ struct nfs_client { #define NFS_CS_INFINITE_SLOTS 3 /* - don't limit TCP slots */ #define NFS_CS_NO_RETRANS_TIMEOUT 4 /* - Disable retransmit timeouts */ #define NFS_CS_TSM_POSSIBLE 5 /* - Maybe state migration */ +#define NFS_CS_UNSHARED 6 /* - Client state is not shared */ struct sockaddr_storage cl_addr; /* server identifier */ size_t cl_addrlen; char * cl_hostname; /* hostname of server */