NFS: Replace calls to nfs_probe_fsinfo() with nfs_probe_server()
authorAnna Schumaker <Anna.Schumaker@Netapp.com>
Thu, 14 Oct 2021 17:55:06 +0000 (13:55 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Wed, 20 Oct 2021 22:09:54 +0000 (18:09 -0400)
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 <Anna.Schumaker@Netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/client.c
fs/nfs/nfs4client.c

index e867d9090386433dfaedcb0dda5ff0753d7089d7..1a882c78a794b91b98cc6108e7a4035ef41d356a 100644 (file)
@@ -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);
 }
index 85978ecb727e8870b40797827030f5f78e9c2c41..d8b5a250ca0501d5edc33a56d28811155f2966fe 100644 (file)
@@ -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;
 }