From patchwork Thu Oct 14 17:55:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12559157 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBA59C433F5 for ; Thu, 14 Oct 2021 17:55:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B1C8361167 for ; Thu, 14 Oct 2021 17:55:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229528AbhJNR5Q (ORCPT ); Thu, 14 Oct 2021 13:57:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233059AbhJNR5Q (ORCPT ); Thu, 14 Oct 2021 13:57:16 -0400 Received: from mail-qv1-xf36.google.com (mail-qv1-xf36.google.com [IPv6:2607:f8b0:4864:20::f36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E55FC061570 for ; Thu, 14 Oct 2021 10:55:11 -0700 (PDT) Received: by mail-qv1-xf36.google.com with SMTP id n12so4212206qvk.3 for ; Thu, 14 Oct 2021 10:55:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ISmsyCdA8i0HSR3KkV7dEglqd7mksKGIyfOdhCrrGv8=; b=WbGJATiBYlVMv0MXKEvDyFxurq/EIrR05ZjoGmBL1P7ncKxARcp8/mUULTmt0SkdBN 00tnUizMe7m3DtcdtoKGX8PVdrv8glwcXWEyuITJNeE7tvnQsmSkfS94Cqy+YvOiXgIY SVTSZMUs4+zpWf2mGAkD4rjA8CZS7M0+qrYEFVXmusEG89QygHFHEY9Ykx/hDPEPPOaQ iXWGdTpCaIJCKcCIF8f+BwdJCF5kuQGXu5CUD/5pXyy5fTs0qIg/F71KXMWHPBkQEZIU SKaRV/1A/qmmf5hjfbgIUbqESgDpR/EvvbuHktJP4qr6EQ0cqgVznug6R7fA6RZp+X1q f1Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ISmsyCdA8i0HSR3KkV7dEglqd7mksKGIyfOdhCrrGv8=; b=o2SqoZlw4rFQJ6EiCBmiAy0Y+eMrvk22PKWxBpg3eUuQPv/BeezYOZuKHy/0EDhWF4 POUVXY6OBDASmPb1cc9fEkZ6GRkbH5o0yxRqyV05j1uoSCHo2fIzDsi1Win3cxOVHP13 ZFQDEWyXoscIUeLuJnJZDXOcjB9A4z8ic9kd4LtjJQ1Y64Plc3drJFace3f2CauXAhoF Eh/XCJY/CktFILASwIyaK5VGNGI+Hhl0Ez2+xOe/R7235w56xrjq9sSTsIFsOHyT+Esf cbDEd+Z+mNF2ALPyd10veguEBocL7xwBlptcxHdZcMntUM+8TXyVX/L/cb63oWgRRZuh Jaiw== X-Gm-Message-State: AOAM532a6Y1PgzD1CTmXdMasmzkgDG1MtJvEYvxu04Vn3jLGtLmuNk2F T2CYIOVjn13cKF4IJDSe6BU= X-Google-Smtp-Source: ABdhPJyPUNWPCWmXSM8UAmTU6xw5dm80yihGh3fGMlN0RgGvGLnHijg/B54UgfTTl6AnnotrpkCRjQ== X-Received: by 2002:ad4:476a:: with SMTP id d10mr6913089qvx.20.1634234110400; Thu, 14 Oct 2021 10:55:10 -0700 (PDT) Received: from localhost.localdomain ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id m6sm1536131qkh.69.2021.10.14.10.55.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Oct 2021 10:55:10 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: Trond.Myklebust@hammerspace.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH 1/5] NFS: Create an nfs4_server_set_init_caps() function Date: Thu, 14 Oct 2021 13:55:04 -0400 Message-Id: <20211014175508.197313-2-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211014175508.197313-1-Anna.Schumaker@Netapp.com> References: <20211014175508.197313-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker And call it before doing an FSINFO probe to reset to the baseline capabilities before probing. Signed-off-by: Anna Schumaker --- fs/nfs/internal.h | 1 + fs/nfs/nfs4client.c | 41 +++++++++++++++++++++++------------------ fs/nfs/nfs4proc.c | 2 ++ 3 files changed, 26 insertions(+), 18 deletions(-) diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 7483f196c6ef..690271adb294 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -209,6 +209,7 @@ extern struct nfs_client * nfs4_find_client_sessionid(struct net *, const struct sockaddr *, struct nfs4_sessionid *, u32); extern struct nfs_server *nfs_create_server(struct fs_context *); +extern void nfs4_server_set_init_caps(struct nfs_server *); extern struct nfs_server *nfs4_create_server(struct fs_context *); extern struct nfs_server *nfs4_create_referral_server(struct fs_context *); extern int nfs4_update_server(struct nfs_server *server, const char *hostname, diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index af57332503be..3fb0ca92377c 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c @@ -1059,31 +1059,15 @@ static void nfs4_session_limit_xasize(struct nfs_server *server) #endif } -static int nfs4_server_common_setup(struct nfs_server *server, - struct nfs_fh *mntfh, bool auth_probe) +void nfs4_server_set_init_caps(struct nfs_server *server) { - struct nfs_fattr *fattr; - int error; - - /* data servers support only a subset of NFSv4.1 */ - if (is_ds_only_client(server->nfs_client)) - return -EPROTONOSUPPORT; - - fattr = nfs_alloc_fattr(); - if (fattr == NULL) - return -ENOMEM; - - /* We must ensure the session is initialised first */ - error = nfs4_init_session(server->nfs_client); - if (error < 0) - goto out; - /* Set the basic capabilities */ server->caps |= server->nfs_client->cl_mvops->init_caps; if (server->flags & NFS_MOUNT_NORDIRPLUS) server->caps &= ~NFS_CAP_READDIRPLUS; if (server->nfs_client->cl_proto == XPRT_TRANSPORT_RDMA) server->caps &= ~NFS_CAP_READ_PLUS; + /* * Don't use NFS uid/gid mapping if we're using AUTH_SYS or lower * authentication. @@ -1091,7 +1075,28 @@ static int nfs4_server_common_setup(struct nfs_server *server, if (nfs4_disable_idmapping && server->client->cl_auth->au_flavor == RPC_AUTH_UNIX) server->caps |= NFS_CAP_UIDGID_NOMAP; +} +static int nfs4_server_common_setup(struct nfs_server *server, + struct nfs_fh *mntfh, bool auth_probe) +{ + struct nfs_fattr *fattr; + int error; + + /* data servers support only a subset of NFSv4.1 */ + if (is_ds_only_client(server->nfs_client)) + return -EPROTONOSUPPORT; + + fattr = nfs_alloc_fattr(); + if (fattr == NULL) + return -ENOMEM; + + /* We must ensure the session is initialised first */ + error = nfs4_init_session(server->nfs_client); + if (error < 0) + goto out; + + nfs4_server_set_init_caps(server); /* Probe the root fh to retrieve its FSID and filehandle */ error = nfs4_get_rootfh(server, mntfh, auth_probe); diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index fc0be32b19fc..77bbdced702f 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -3923,6 +3923,8 @@ int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle) .interruptible = true, }; int err; + + nfs4_server_set_init_caps(server); do { err = nfs4_handle_exception(server, _nfs4_server_capabilities(server, fhandle), From patchwork Thu Oct 14 17:55:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12559159 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15614C433FE for ; Thu, 14 Oct 2021 17:55:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ECF6261167 for ; Thu, 14 Oct 2021 17:55:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233291AbhJNR5R (ORCPT ); Thu, 14 Oct 2021 13:57:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233059AbhJNR5R (ORCPT ); Thu, 14 Oct 2021 13:57:17 -0400 Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4F47C061570 for ; Thu, 14 Oct 2021 10:55:11 -0700 (PDT) Received: by mail-qk1-x72d.google.com with SMTP id bi9so6187764qkb.11 for ; Thu, 14 Oct 2021 10:55:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hkCl4AhoMlF3zujXe2g18GkqBQoCDlCVA09o/GacXFU=; b=EGR90zMCcmumdmn3OTR4tBZeCYSy2yE1OAQjF8qYxbzuxmHnLnProqZtaQEvoMwHzB ZW3ptzsIaQsOC7nVmyVLEqKxltwn3Z1qRqLc2jLVKKDHJoc/ctlxUC0hApgv7mhdmXW3 s1xHi6zTTELHP0rNtIxRRjzJrHKyZcHqXLrwX5c6wFSagUqc4bhlcrasfY8EHAT6qoZB R/kTjscsuHWu6eT8ghmsFz+r9d6pU7HHEWHV481HNiInUcnevEeyH761T80RS8wACXpK OXuj4zJb1ZNc+m74SrXhqcAsG/TNO2OX/C2TG4r6Mfzicuwi+aPabh0pR8tTpeu/rgsI 6HNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=hkCl4AhoMlF3zujXe2g18GkqBQoCDlCVA09o/GacXFU=; b=gZfYCt6wCA4/eqM48bAssrSK04pdu7L46iDsxSP8LjZ9ZQXw1r041gbboHKx9ge40e tNmzPHg7T1bQ2XZricIDN1E7ZoatWX90dmPmG6ANdzlTfhGVZj9YINy/dy0a3OKksbjv heKWrmW866PEnTLeSDbMdA3Y1BAvJL2UCi4cs7pCvT29WAPK/28gGmw5umbOR5M2sqBE UNEhLmDlQdiNzqr1XvF+CLjEk8zfkk90hZvujypnFR2EUQfG+CaR56nZtCrvCn7Kgt6g d7Xmvc+17aIUo3oAUC7wV5YfEBFj92v6h5DTFtKbo0FiKMe6/8F5zZpvpUWwok1vVa6t Wc3A== X-Gm-Message-State: AOAM531B2U1RVf+4XvFC4A7UqiFfDUVO/XrkfkJWpWPbu5YADrUnGj3o +qJixxKVKb+7R9BclqBlwso= X-Google-Smtp-Source: ABdhPJylt32tkX5QkqsSart9w8ciW7PHJ8k/pROkhoEBXlu/Abbkc+AoJxornmWmakFwjObcxcDvFQ== X-Received: by 2002:a37:44cc:: with SMTP id r195mr6340988qka.77.1634234111004; Thu, 14 Oct 2021 10:55:11 -0700 (PDT) Received: from localhost.localdomain ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id m6sm1536131qkh.69.2021.10.14.10.55.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Oct 2021 10:55:10 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: Trond.Myklebust@hammerspace.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH 2/5] NFS: Move nfs_probe_destination() into the generic client Date: Thu, 14 Oct 2021 13:55:05 -0400 Message-Id: <20211014175508.197313-3-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211014175508.197313-1-Anna.Schumaker@Netapp.com> References: <20211014175508.197313-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker And rename it to nfs_probe_server(). I also change it to take the nfs_fh as an argument so callers can choose what filehandle to probe. Signed-off-by: Anna Schumaker --- fs/nfs/client.c | 24 ++++++++++++++++++++++++ fs/nfs/internal.h | 1 + fs/nfs/nfs4client.c | 26 +------------------------- 3 files changed, 26 insertions(+), 25 deletions(-) diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 6956079b7741..b7b79a348c2b 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -864,6 +864,30 @@ int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *mntfh, struct nfs } EXPORT_SYMBOL_GPL(nfs_probe_fsinfo); +/* + * Grab the destination's particulars, including lease expiry time. + * + * Returns zero if probe succeeded and retrieved FSID matches the FSID + * we have cached. + */ +int nfs_probe_server(struct nfs_server *server, struct nfs_fh *mntfh) +{ + struct nfs_fattr *fattr; + int error; + + fattr = nfs_alloc_fattr(); + if (fattr == NULL) + return -ENOMEM; + + /* Sanity: the probe won't work if the destination server + * does not recognize the migrated FH. */ + error = nfs_probe_fsinfo(server, mntfh, fattr); + + nfs_free_fattr(fattr); + return error; +} +EXPORT_SYMBOL_GPL(nfs_probe_server); + /* * Copy useful information when duplicating a server record */ diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 690271adb294..508cb64c2661 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -194,6 +194,7 @@ extern struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *); int nfs_create_rpc_client(struct nfs_client *, const struct nfs_client_initdata *, rpc_authflavor_t); struct nfs_client *nfs_get_client(const struct nfs_client_initdata *); int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *, struct nfs_fattr *); +int nfs_probe_server(struct nfs_server *, struct nfs_fh *); void nfs_server_insert_lists(struct nfs_server *); void nfs_server_remove_lists(struct nfs_server *); void nfs_init_timeout_values(struct rpc_timeout *to, int proto, int timeo, int retrans); diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index 3fb0ca92377c..85978ecb727e 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c @@ -1293,30 +1293,6 @@ struct nfs_server *nfs4_create_referral_server(struct fs_context *fc) return ERR_PTR(error); } -/* - * Grab the destination's particulars, including lease expiry time. - * - * Returns zero if probe succeeded and retrieved FSID matches the FSID - * we have cached. - */ -static int nfs_probe_destination(struct nfs_server *server) -{ - struct inode *inode = d_inode(server->super->s_root); - struct nfs_fattr *fattr; - int error; - - fattr = nfs_alloc_fattr(); - if (fattr == NULL) - return -ENOMEM; - - /* Sanity: the probe won't work if the destination server - * does not recognize the migrated FH. */ - error = nfs_probe_fsinfo(server, NFS_FH(inode), fattr); - - nfs_free_fattr(fattr); - return error; -} - /** * nfs4_update_server - Move an nfs_server to a different nfs_client * @@ -1377,5 +1353,5 @@ int nfs4_update_server(struct nfs_server *server, const char *hostname, server->nfs_client->cl_hostname = kstrdup(hostname, GFP_KERNEL); nfs_server_insert_lists(server); - return nfs_probe_destination(server); + return nfs_probe_server(server, NFS_FH(d_inode(server->super->s_root))); } From patchwork Thu Oct 14 17:55:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12559161 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3989C433F5 for ; Thu, 14 Oct 2021 17:55:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ADF1461152 for ; Thu, 14 Oct 2021 17:55:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233779AbhJNR5S (ORCPT ); Thu, 14 Oct 2021 13:57:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233199AbhJNR5R (ORCPT ); Thu, 14 Oct 2021 13:57:17 -0400 Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AA59C061753 for ; Thu, 14 Oct 2021 10:55:12 -0700 (PDT) Received: by mail-qk1-x735.google.com with SMTP id p4so6238413qki.3 for ; Thu, 14 Oct 2021 10:55:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=j28KvjFQKnh8F2mr0scE3JBhKS0v4PXIXSytFkREKq8=; b=ia70gp6Zyepoih3SSqShgVuffb+gIBs6rwpZ7oXJVbwmrjlaULsXr4rxt4YkiTZOhs qfreRKYIJV5KfA4gWQUooHmxMmOZfz+0uNcHTLfTJIw3PI16DftNu4SKhrVuB6um36t7 ZO7g89B1ZPanQSGA30BCGdXTGfXEOsbL3rIyCnEGenPTUbSwXExNkLr11OuHPhlTBn9Q 16H9PHfilCk25Cd8pFtNLpvjJhgGyQGJyNRMp7CpuIrB1UcIIvVh3N9RQCLThuictCFW AD4v2m9mSMwv2gaoDjTWOGmRBACmTf1JfrZv3/xeKA1JejDwiTjuweW50vJkG5D+r8M/ Czbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=j28KvjFQKnh8F2mr0scE3JBhKS0v4PXIXSytFkREKq8=; b=npdUAm+5MG9/2u6UFrl+riyMiYK/GYXLh6gL7aYZDLozq90wakuqb77fSH1GxxaC2q T3k20y9T+ndi0RQnCyBVpdQsEgVmN2DAcs7sXfob3AY+VNDYFS+s3cL7r/lghUaREpPW tNFbVnD53AXxCrHTAG9SNwI1dfuzhLFbEXDSIlSj96pfYSJAZaF/or/yy+Zh6zaZ5jc/ rubvVwMtxRTj31RjjjH8aGvo3dSU6Oc+2arLuQ3kZFlKLrNB90fTSP3wAS0O9Hsv4qhZ hnC4wpYlWv18OMQY/J2/tcrI0AmyN8MWQ0mjdMBu/MubceY7yxm5hh6ztrcIs83+Xfl8 E/0Q== X-Gm-Message-State: AOAM533ZKuhstClb7GpT/X2rTwpb8TPNn9v/x5l7GiP8K4kzVYFciEcY dJxUNKINhBhUd3JJxLJF2ZfR/2jMR4k= X-Google-Smtp-Source: ABdhPJziuAgVPoORB7N6YlDAx0CwWjoyf9zEUy5vM5WS2wjt/5cGNzkWDKvgs0PR9Foy/3Ges4NA6Q== X-Received: by 2002:ae9:d8c6:: with SMTP id u189mr6221288qkf.391.1634234111613; Thu, 14 Oct 2021 10:55:11 -0700 (PDT) Received: from localhost.localdomain ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id m6sm1536131qkh.69.2021.10.14.10.55.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Oct 2021 10:55:11 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: Trond.Myklebust@hammerspace.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH 3/5] NFS: Replace calls to nfs_probe_fsinfo() with nfs_probe_server() Date: Thu, 14 Oct 2021 13:55:06 -0400 Message-Id: <20211014175508.197313-4-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211014175508.197313-1-Anna.Schumaker@Netapp.com> References: <20211014175508.197313-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker Clean up. There are a few places where we want to probe the server, but don't actually care about the fsinfo result. Change these to use nfs_probe_server(), which handles the fattr allocation for us. Signed-off-by: Anna Schumaker --- fs/nfs/client.c | 10 +--------- fs/nfs/nfs4client.c | 8 +------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/fs/nfs/client.c b/fs/nfs/client.c index b7b79a348c2b..7f30a6c1a0b0 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -1082,7 +1082,6 @@ struct nfs_server *nfs_clone_server(struct nfs_server *source, rpc_authflavor_t flavor) { struct nfs_server *server; - struct nfs_fattr *fattr_fsinfo; int error; server = nfs_alloc_server(); @@ -1091,11 +1090,6 @@ struct nfs_server *nfs_clone_server(struct nfs_server *source, server->cred = get_cred(source->cred); - error = -ENOMEM; - fattr_fsinfo = nfs_alloc_fattr(); - if (fattr_fsinfo == NULL) - goto out_free_server; - /* Copy data from the source */ server->nfs_client = source->nfs_client; server->destroy = source->destroy; @@ -1111,7 +1105,7 @@ struct nfs_server *nfs_clone_server(struct nfs_server *source, goto out_free_server; /* probe the filesystem info for this server filesystem */ - error = nfs_probe_fsinfo(server, fh, fattr_fsinfo); + error = nfs_probe_server(server, fh); if (error < 0) goto out_free_server; @@ -1125,11 +1119,9 @@ struct nfs_server *nfs_clone_server(struct nfs_server *source, nfs_server_insert_lists(server); server->mount_time = jiffies; - nfs_free_fattr(fattr_fsinfo); return server; out_free_server: - nfs_free_fattr(fattr_fsinfo); nfs_free_server(server); return ERR_PTR(error); } diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index 85978ecb727e..d8b5a250ca05 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c @@ -1080,17 +1080,12 @@ void nfs4_server_set_init_caps(struct nfs_server *server) static int nfs4_server_common_setup(struct nfs_server *server, struct nfs_fh *mntfh, bool auth_probe) { - struct nfs_fattr *fattr; int error; /* data servers support only a subset of NFSv4.1 */ if (is_ds_only_client(server->nfs_client)) return -EPROTONOSUPPORT; - fattr = nfs_alloc_fattr(); - if (fattr == NULL) - return -ENOMEM; - /* We must ensure the session is initialised first */ error = nfs4_init_session(server->nfs_client); if (error < 0) @@ -1108,7 +1103,7 @@ static int nfs4_server_common_setup(struct nfs_server *server, (unsigned long long) server->fsid.minor); nfs_display_fhandle(mntfh, "Pseudo-fs root FH"); - error = nfs_probe_fsinfo(server, mntfh, fattr); + error = nfs_probe_server(server, mntfh); if (error < 0) goto out; @@ -1122,7 +1117,6 @@ static int nfs4_server_common_setup(struct nfs_server *server, server->mount_time = jiffies; server->destroy = nfs4_destroy_server; out: - nfs_free_fattr(fattr); return error; } From patchwork Thu Oct 14 17:55:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12559163 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71BBDC433EF for ; Thu, 14 Oct 2021 17:55:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5714B611C0 for ; Thu, 14 Oct 2021 17:55:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233771AbhJNR5T (ORCPT ); Thu, 14 Oct 2021 13:57:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233764AbhJNR5S (ORCPT ); Thu, 14 Oct 2021 13:57:18 -0400 Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B6FAC061570 for ; Thu, 14 Oct 2021 10:55:13 -0700 (PDT) Received: by mail-qv1-xf2f.google.com with SMTP id z15so4204393qvj.7 for ; Thu, 14 Oct 2021 10:55:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wCc0FNN3Mdu7l4DV6pbSGmAPSEI5nFZIgawlHakFoTQ=; b=PNIEoacV1fHYNukXPU+8WhMMFhGn1f/K3NtBFPPfIIJ9IF5s9pbcNoYcgAPeA0AllE idNJD9LPDxXt99HCVcqFIUqOe8uv91maRzUTy2NAZV8DlroB02saBjKFnGiClKGlM5F9 lvT4TWRXJMIzPWtba+CzABDBkjSzfNgqjXesTU65ox150ezLxqXpsfK396fwaeUBjVL2 WLA6SF65vnZSRb+TZZ1mNiNt6CihzCk04z/u4hrkziwOuOjN2ODHiadaevEy6ZhS60f6 sC4xvz+0mV9iQSeOdMD/AvjZwQOMeE0Bypr9vabl50iD2arsskEI1lu0JEH5RDxKTO9z 8vfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=wCc0FNN3Mdu7l4DV6pbSGmAPSEI5nFZIgawlHakFoTQ=; b=FnAm5sXfizvduIY9OcMw8+zjVY5wnPh8OSj+vZpxIew7LNdu/4Tf0Kv9VasEYxC9zc GQ23iXWK38C/Xppp9nv/AqiHx2RrTKAJ0Kl8X0nDHa432y7WwVNAnga9eN4P0VS9ym/b yVO9tsb78Vn6c22EkiXbtIu8B1jWiF8mmlnWhc95bL/GGwm6Oy4MzBpZHCLm80n8E/RW aeHUNxa6d6HtLHHJ4m6YvfAwPA8yKmVeZJwYQZGtvldA4b/v9uRuMDhbWq1Mkef+uhKm kOXf5H1Lupf2LEYNocJb17J2uIpFfglXH2Gb8XlxGElqb/+bHa1xUjZMPUNRNhaHCKno YQ7g== X-Gm-Message-State: AOAM530PjqT6wMJigNT5xLsU/jYVYu6La+VhLzXVJ2sD/2XqFF2NEp0o 08Py63Ds86cEcvfdJc+5OQVDRuTZ938= X-Google-Smtp-Source: ABdhPJznR9qkS21cS1J/DuCO3Q00dzfpc2r9wb4BH4OIZ33ktYU/15eRb7jM7M5A+X8uwnTrSEPOKQ== X-Received: by 2002:ad4:5de9:: with SMTP id jn9mr6749093qvb.41.1634234112165; Thu, 14 Oct 2021 10:55:12 -0700 (PDT) Received: from localhost.localdomain ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id m6sm1536131qkh.69.2021.10.14.10.55.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Oct 2021 10:55:11 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: Trond.Myklebust@hammerspace.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH 4/5] NFS: Call nfs_probe_server() during a fscontext-reconfigure event Date: Thu, 14 Oct 2021 13:55:07 -0400 Message-Id: <20211014175508.197313-5-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211014175508.197313-1-Anna.Schumaker@Netapp.com> References: <20211014175508.197313-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker This lets us update the server's attributes when the user does a "mount -o remount" on the filesystem. Signed-off-by: Anna Schumaker --- fs/nfs/super.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/nfs/super.c b/fs/nfs/super.c index e65c83494c05..3aced401735c 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -1004,6 +1004,7 @@ int nfs_reconfigure(struct fs_context *fc) struct nfs_fs_context *ctx = nfs_fc2context(fc); struct super_block *sb = fc->root->d_sb; struct nfs_server *nfss = sb->s_fs_info; + int ret; sync_filesystem(sb); @@ -1028,7 +1029,11 @@ int nfs_reconfigure(struct fs_context *fc) } /* compare new mount options with old ones */ - return nfs_compare_remount_data(nfss, ctx); + ret = nfs_compare_remount_data(nfss, ctx); + if (ret) + return ret; + + return nfs_probe_server(nfss, NFS_FH(d_inode(fc->root))); } EXPORT_SYMBOL_GPL(nfs_reconfigure); From patchwork Thu Oct 14 17:55:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12559165 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63264C433FE for ; Thu, 14 Oct 2021 17:55:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 474FD61167 for ; Thu, 14 Oct 2021 17:55:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233199AbhJNR5U (ORCPT ); Thu, 14 Oct 2021 13:57:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233773AbhJNR5T (ORCPT ); Thu, 14 Oct 2021 13:57:19 -0400 Received: from mail-qv1-xf36.google.com (mail-qv1-xf36.google.com [IPv6:2607:f8b0:4864:20::f36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23D2EC061570 for ; Thu, 14 Oct 2021 10:55:14 -0700 (PDT) Received: by mail-qv1-xf36.google.com with SMTP id z3so4201085qvl.9 for ; Thu, 14 Oct 2021 10:55:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ooXUaPsDW36LEYss3e9YwlUtHeSl9e6veGzBqPcOAKY=; b=paRbI4LK3gkfYOPHgrtNH55h0krrFl1mF5eszsv9XPfsnqAW+d7qNSYRu1WLrbO3fZ AX4B5fQDopLF0ILpJzBqCyQJMXTsihp7PWN9lSLOt5kWAAGuL/U2HMYTcGFsPzBP7O3s MR4d9pMG5yfdUZkKnJAmwfVUuVnY3XjYqtwW8unwyIgk7bNhiR7CQDz+omMxIq5Im4xN 8Xi1nR5OZpl4A8FRmG0ry34l5di6wMJYqIFp4ZufMzJ/dOfj6mazoAZzmqGfnCVy/8Nx imZRnHt4yesH3PM5/KkM22P9kezcftDN0LguD4RT895kMKjME21S5cmubHJrBfyuL/yr s7NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ooXUaPsDW36LEYss3e9YwlUtHeSl9e6veGzBqPcOAKY=; b=kZNhPZhLWklPN00B8F3fkmPMQVsZXGA50aNPeYpKNdl7+n8RkX4TepqX8qxkiDLeW4 83cFA1FD6ZAHpQoQ48B7jYETIh6tnXBv3B3VjLwPw6PkxNu4jN6jXo8SoMXgIadk000k Qsywwpasr3FDykhj1gAhYTbH2VNVTYjUZyE/TkKJ8tshjiFjDj3IDUuNA4pI4Owl9QiE tE0IzGKpW5rgufBAKgGGGI66deDU+QWuEcyOvGF6vrMknWIrrqkXNxCF2SuvG99s4ZTC IIHMy1OzpYDe2DH+gW4A9IZ+hwQBJBhFQJSxZ9L5jxEm7JVoavbL7pX9FmRgT/BKcdUq BBNQ== X-Gm-Message-State: AOAM531zO00QIHtInrKCAlDnRBqB0T9IYwnm3GiB9nahp9kvLC7Iagj4 rxCUovEYgz/IbQ/dfWMpoYUGOlkxbBA= X-Google-Smtp-Source: ABdhPJzA2N4+gkrx1QiZmlNPPiDN3ZjZAVZcd2QF+bxOIOkKy5VPOvxAnC0G+VFeXwdNRYu+1W9n4Q== X-Received: by 2002:a0c:da8b:: with SMTP id z11mr6915038qvj.24.1634234113302; Thu, 14 Oct 2021 10:55:13 -0700 (PDT) Received: from localhost.localdomain ([2601:401:100:a3a:aa6d:aaff:fe2e:8a6a]) by smtp.gmail.com with ESMTPSA id m6sm1536131qkh.69.2021.10.14.10.55.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Oct 2021 10:55:12 -0700 (PDT) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: Trond.Myklebust@hammerspace.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH 5/5] NFS: Unexport nfs_probe_fsinfo() Date: Thu, 14 Oct 2021 13:55:08 -0400 Message-Id: <20211014175508.197313-6-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211014175508.197313-1-Anna.Schumaker@Netapp.com> References: <20211014175508.197313-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker All the callers are now in client.c so we can remove the EXPORT_SYMBOL_GPL() and make it static. Signed-off-by: Anna Schumaker --- fs/nfs/client.c | 3 +-- fs/nfs/internal.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 7f30a6c1a0b0..1e4dc1ab9312 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -828,7 +828,7 @@ static void nfs_server_set_fsinfo(struct nfs_server *server, /* * Probe filesystem information, including the FSID on v2/v3 */ -int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *mntfh, struct nfs_fattr *fattr) +static int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *mntfh, struct nfs_fattr *fattr) { struct nfs_fsinfo fsinfo; struct nfs_client *clp = server->nfs_client; @@ -862,7 +862,6 @@ int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *mntfh, struct nfs return 0; } -EXPORT_SYMBOL_GPL(nfs_probe_fsinfo); /* * Grab the destination's particulars, including lease expiry time. diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 508cb64c2661..12f6acb483bb 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -193,7 +193,6 @@ extern void nfs_clients_exit(struct net *net); extern struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *); int nfs_create_rpc_client(struct nfs_client *, const struct nfs_client_initdata *, rpc_authflavor_t); struct nfs_client *nfs_get_client(const struct nfs_client_initdata *); -int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *, struct nfs_fattr *); int nfs_probe_server(struct nfs_server *, struct nfs_fh *); void nfs_server_insert_lists(struct nfs_server *); void nfs_server_remove_lists(struct nfs_server *);