Skip to content

Commit

Permalink
NFS: Replace calls to nfs_probe_fsinfo() with nfs_probe_server()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
  • Loading branch information
amschuma-ntap authored and Trond Myklebust committed Oct 20, 2021
1 parent e573113 commit 4d4cf8d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
10 changes: 1 addition & 9 deletions fs/nfs/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
Expand All @@ -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;

Expand All @@ -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);
}
Expand Down
8 changes: 1 addition & 7 deletions fs/nfs/nfs4client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;

Expand All @@ -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;
}

Expand Down

0 comments on commit 4d4cf8d

Please sign in to comment.