Skip to content

Commit

Permalink
Don't use portmapper to discover the port for NFSv4
Browse files Browse the repository at this point in the history
Default to use port 2049. If server runs on a different port then
we must manually override this with the nfsport flag.
NFSv4 servers can run without any portmapper daemon at all and we
must be prepared for that.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
  • Loading branch information
sahlberg committed Apr 29, 2018
1 parent 9edb107 commit 456e525
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
21 changes: 5 additions & 16 deletions lib/nfs_v4.c
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,7 @@ nfs4_mount_async(struct nfs_context *nfs, const char *server,
{
struct nfs4_cb_data *data;
char *new_server, *new_export;
int port;

new_server = strdup(server);
free(nfs->server);
Expand Down Expand Up @@ -1614,27 +1615,15 @@ nfs4_mount_async(struct nfs_context *nfs, const char *server,
data->private_data = private_data;
data->path = strdup(new_export);

if (nfs->nfsport) {
if (rpc_connect_port_async(nfs->rpc, server, nfs->nfsport,
NFS4_PROGRAM, NFS_V4,
nfs4_mount_1_cb, data) != 0) {
nfs_set_error(nfs, "Failed to start connection. %s",
nfs_get_error(nfs));
free_nfs4_cb_data(data);
return -1;
}
return 0;
}

if (rpc_connect_program_async(nfs->rpc, server,
NFS4_PROGRAM, NFS_V4,
nfs4_mount_1_cb, data) != 0) {
port = nfs->nfsport ? nfs->nfsport : 2049;
if (rpc_connect_port_async(nfs->rpc, server, port,
NFS4_PROGRAM, NFS_V4,
nfs4_mount_1_cb, data) != 0) {
nfs_set_error(nfs, "Failed to start connection. %s",
nfs_get_error(nfs));
free_nfs4_cb_data(data);
return -1;
}

return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/test_8000_timeout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ echo "NFSv${VERS} Basic timeout test."
if [ $VERS -eq 3 ]; then
COUNT=28
else
COUNT=18
COUNT=13
fi

start_share
Expand Down

0 comments on commit 456e525

Please sign in to comment.