NFS: Move nfs_probe_destination() into the generic client
authorAnna Schumaker <Anna.Schumaker@Netapp.com>
Thu, 14 Oct 2021 17:55:05 +0000 (13:55 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Wed, 20 Oct 2021 22:09:54 +0000 (18:09 -0400)
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 <Anna.Schumaker@Netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/client.c
fs/nfs/internal.h
fs/nfs/nfs4client.c

index 23e165d5ec9cabfe7297f1f5158f73ef6e16f184..e867d9090386433dfaedcb0dda5ff0753d7089d7 100644 (file)
@@ -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
  */
index ee14d71da4a1210b3d8d378f75ef5add99b916f7..c1253dd60c3212fdcfdd47507437e99c8381f682 100644 (file)
@@ -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);
index 3fb0ca92377ced5afaf95b123b0505037490345d..85978ecb727e8870b40797827030f5f78e9c2c41 100644 (file)
@@ -1293,30 +1293,6 @@ error:
        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)));
 }