Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5342654ybl; Tue, 10 Dec 2019 04:33:47 -0800 (PST) X-Google-Smtp-Source: APXvYqy3TmVmie2RMFxNUI+s1RGhajVid72qHLT54fzLZ52AQxl81UE6FIiirRtF1uE/9TqppgBc X-Received: by 2002:aca:ef85:: with SMTP id n127mr3795810oih.54.1575981227126; Tue, 10 Dec 2019 04:33:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575981227; cv=none; d=google.com; s=arc-20160816; b=K9Gw0xtSS5Xo/qf0ES9GInuTrUsgnuIWO04ON7RvW+SFAi904xLqzSfRs0yOgpAgMg CtR4APBtt5TLw7TWYf+AOtN0QmumQ4Hen0R1TaghADi3DYuxZDQNoWQm2tQCU/qkPgPg bXoMkOEYWM6Kuo9RIphQfbCk+aHZBaHNDW9BT7B9p0sXEUMXZ9DO6fI5LZSLKEERoqGa YxwWN1LnPwqIPvvnsz3/Rlvn2t98ZnYVRfV9wZW3X/SSrlIcMAEzlGKesv87Jj2j8zGC LC+ej2HNrwbEqA4hR8IEunlfE8nBlqlCtKNdpgUZnug6GdrNyXW8Bj7GwZRTq3R0O1Qa afEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=4CxEQ5z2P35PU5qEnTEcH9MyNfCjukSbjzhDjqs04MQ=; b=tWi1o+6VMioZUu+oT96yldZ6WCo5Bw4cWMFjSc9pCDsD45m0ek7KxOFcHBfZiP/NS6 1sSNbskwOISa5mu/fT71spu9mUFmPWdH8mNxDIb2+tqrAiXHG8Snvo8yiMjnkSxDax80 0reF8Y9oouq+0YK549sOrnlqMpQeyLA52PCB/b/aFukJbEk1emefUT7CuG/JXNnJMQiF foKv2Xw85t+8d2POxVXN0vA0XombQYZy26NP3WV73roVDPIeGVEzeMcauCeXJWXXOSWi 8TsFXJjhtQLSIpXjbE0Oay35pIrhxqrjq9DqjkFxf1ZX0us1M5UgcG1giSXWMnGrKCQu hE8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=b3gPQFGz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e23si1830784otr.145.2019.12.10.04.33.34; Tue, 10 Dec 2019 04:33:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=b3gPQFGz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727627AbfLJMce (ORCPT + 99 others); Tue, 10 Dec 2019 07:32:34 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:53575 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727494AbfLJMbY (ORCPT ); Tue, 10 Dec 2019 07:31:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575981082; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4CxEQ5z2P35PU5qEnTEcH9MyNfCjukSbjzhDjqs04MQ=; b=b3gPQFGzk7zBc68gDAAPUDR+HL7NECsN5DgBay/ZmN60nPnuT7ew4+1HdKO0fB8uBNOY14 v7adsgb654QJXrrQXo780Gg9SbuhhSjebPKaz3weRGOTvTSTmxYY9vDit4FQvNkVYfm3Pa 2W1V0vU8WaqZw0X2ahGqAbAvnAt05hs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-421-dwRglwilOo-3WYmw05ymMQ-1; Tue, 10 Dec 2019 07:31:18 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A8F5E107ACCD; Tue, 10 Dec 2019 12:31:16 +0000 (UTC) Received: from coeurl.usersys.redhat.com (ovpn-123-90.rdu2.redhat.com [10.10.123.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2396C60BF3; Tue, 10 Dec 2019 12:31:16 +0000 (UTC) Received: by coeurl.usersys.redhat.com (Postfix, from userid 1000) id 9516020AE5; Tue, 10 Dec 2019 07:31:15 -0500 (EST) From: Scott Mayhew To: anna.schumaker@netapp.com, trond.myklebust@hammerspace.com Cc: dhowells@redhat.com, viro@zeniv.linux.org.uk, linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org Subject: [PATCH v6 02/27] nfs: stash server into struct nfs_mount_info Date: Tue, 10 Dec 2019 07:30:50 -0500 Message-Id: <20191210123115.1655-3-smayhew@redhat.com> In-Reply-To: <20191210123115.1655-1-smayhew@redhat.com> References: <20191210123115.1655-1-smayhew@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: dwRglwilOo-3WYmw05ymMQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro Reviewed-by: David Howells Signed-off-by: Al Viro --- fs/nfs/internal.h | 3 ++- fs/nfs/nfs4super.c | 10 ++++------ fs/nfs/super.c | 19 ++++++++----------- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 24a65da58aa9..8f4900bd04f7 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -142,6 +142,7 @@ struct nfs_mount_info { =09int (*set_security)(struct super_block *, struct dentry *, struct nfs_m= ount_info *); =09struct nfs_parsed_mount_data *parsed; =09struct nfs_clone_mount *cloned; +=09struct nfs_server *server; =09struct nfs_fh *mntfh; }; =20 @@ -397,7 +398,7 @@ struct dentry *nfs_try_mount(int, const char *, struct = nfs_mount_info *, =09=09=09struct nfs_subversion *); int nfs_set_sb_security(struct super_block *, struct dentry *, struct nfs_= mount_info *); int nfs_clone_sb_security(struct super_block *, struct dentry *, struct nf= s_mount_info *); -struct dentry *nfs_fs_mount_common(struct nfs_server *, int, const char *, +struct dentry *nfs_fs_mount_common(int, const char *, =09=09=09=09 struct nfs_mount_info *, struct nfs_subversion *); struct dentry *nfs_fs_mount(struct file_system_type *, int, const char *, = void *); struct dentry * nfs_xdev_mount_common(struct file_system_type *, int, diff --git a/fs/nfs/nfs4super.c b/fs/nfs/nfs4super.c index beeaed872e6c..e7f2fd1925b1 100644 --- a/fs/nfs/nfs4super.c +++ b/fs/nfs/nfs4super.c @@ -109,13 +109,12 @@ nfs4_remote_mount(struct file_system_type *fs_type, i= nt flags, =09=09 const char *dev_name, void *info) { =09struct nfs_mount_info *mount_info =3D info; -=09struct nfs_server *server; =20 =09mount_info->set_security =3D nfs_set_sb_security; =20 =09/* Get a volume representation */ -=09server =3D nfs4_create_server(mount_info, &nfs_v4); -=09return nfs_fs_mount_common(server, flags, dev_name, mount_info, &nfs_v4= ); +=09mount_info->server =3D nfs4_create_server(mount_info, &nfs_v4); +=09return nfs_fs_mount_common(flags, dev_name, mount_info, &nfs_v4); } =20 static struct vfsmount *nfs_do_root_mount(struct file_system_type *fs_type= , @@ -260,7 +259,6 @@ nfs4_remote_referral_mount(struct file_system_type *fs_= type, int flags, =09=09.set_security =3D nfs_clone_sb_security, =09=09.cloned =3D raw_data, =09}; -=09struct nfs_server *server; =09struct dentry *mntroot =3D ERR_PTR(-ENOMEM); =20 =09dprintk("--> nfs4_referral_get_sb()\n"); @@ -270,8 +268,8 @@ nfs4_remote_referral_mount(struct file_system_type *fs_= type, int flags, =09=09goto out; =20 =09/* create a new volume representation */ -=09server =3D nfs4_create_referral_server(mount_info.cloned, mount_info.mn= tfh); -=09mntroot =3D nfs_fs_mount_common(server, flags, dev_name, &mount_info, &= nfs_v4); +=09mount_info.server =3D nfs4_create_referral_server(mount_info.cloned, mo= unt_info.mntfh); +=09mntroot =3D nfs_fs_mount_common(flags, dev_name, &mount_info, &nfs_v4); out: =09nfs_free_fhandle(mount_info.mntfh); =09return mntroot; diff --git a/fs/nfs/super.c b/fs/nfs/super.c index f074c3773f0e..379c7b26051d 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -1896,14 +1896,12 @@ struct dentry *nfs_try_mount(int flags, const char = *dev_name, =09=09=09 struct nfs_mount_info *mount_info, =09=09=09 struct nfs_subversion *nfs_mod) { -=09struct nfs_server *server; - =09if (mount_info->parsed->need_mount) -=09=09server =3D nfs_try_mount_request(mount_info, nfs_mod); +=09=09mount_info->server =3D nfs_try_mount_request(mount_info, nfs_mod); =09else -=09=09server =3D nfs_mod->rpc_ops->create_server(mount_info, nfs_mod); +=09=09mount_info->server =3D nfs_mod->rpc_ops->create_server(mount_info, n= fs_mod); =20 -=09return nfs_fs_mount_common(server, flags, dev_name, mount_info, nfs_mod= ); +=09return nfs_fs_mount_common(flags, dev_name, mount_info, nfs_mod); } EXPORT_SYMBOL_GPL(nfs_try_mount); =20 @@ -2649,20 +2647,21 @@ static void nfs_set_readahead(struct backing_dev_in= fo *bdi, =09bdi->io_pages =3D iomax_pages; } =20 -struct dentry *nfs_fs_mount_common(struct nfs_server *server, -=09=09=09=09 int flags, const char *dev_name, +struct dentry *nfs_fs_mount_common(int flags, const char *dev_name, =09=09=09=09 struct nfs_mount_info *mount_info, =09=09=09=09 struct nfs_subversion *nfs_mod) { =09struct super_block *s; =09struct dentry *mntroot =3D ERR_PTR(-ENOMEM); =09int (*compare_super)(struct super_block *, void *) =3D nfs_compare_supe= r; +=09struct nfs_server *server =3D mount_info->server; =09struct nfs_sb_mountdata sb_mntdata =3D { =09=09.mntflags =3D flags, =09=09.server =3D server, =09}; =09int error; =20 +=09mount_info->server =3D NULL; =09if (IS_ERR(server)) =09=09return ERR_CAST(server); =20 @@ -2803,7 +2802,6 @@ nfs_xdev_mount(struct file_system_type *fs_type, int = flags, =09=09.set_security =3D nfs_clone_sb_security, =09=09.cloned =3D data, =09}; -=09struct nfs_server *server; =09struct dentry *mntroot =3D ERR_PTR(-ENOMEM); =09struct nfs_subversion *nfs_mod =3D NFS_SB(data->sb)->nfs_client->cl_nfs= _mod; =20 @@ -2812,10 +2810,9 @@ nfs_xdev_mount(struct file_system_type *fs_type, int= flags, =09mount_info.mntfh =3D mount_info.cloned->fh; =20 =09/* create a new volume representation */ -=09server =3D nfs_mod->rpc_ops->clone_server(NFS_SB(data->sb), data->fh, d= ata->fattr, data->authflavor); +=09mount_info.server =3D nfs_mod->rpc_ops->clone_server(NFS_SB(data->sb), = data->fh, data->fattr, data->authflavor); =20 -=09mntroot =3D nfs_fs_mount_common(server, flags, -=09=09=09=09dev_name, &mount_info, nfs_mod); +=09mntroot =3D nfs_fs_mount_common(flags, dev_name, &mount_info, nfs_mod); =20 =09dprintk("<-- nfs_xdev_mount() =3D %ld\n", =09=09=09IS_ERR(mntroot) ? PTR_ERR(mntroot) : 0L); --=20 2.17.2