NFS: Remove the NIPQUAD from nfs_try_mount
In the name of address family compatibility, we can't have the NIP_FMT and NIPQUAD macros in nfs_try_mount(). Instead, we can make use of an unused mount option to display the mount server's hostname. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
committed by
Trond Myklebust
parent
6677d09513
commit
338320345b
@@ -89,7 +89,7 @@ enum {
|
|||||||
Opt_nfsvers,
|
Opt_nfsvers,
|
||||||
|
|
||||||
/* Mount options that take string arguments */
|
/* Mount options that take string arguments */
|
||||||
Opt_sec, Opt_proto, Opt_mountproto,
|
Opt_sec, Opt_proto, Opt_mountproto, Opt_mounthost,
|
||||||
Opt_addr, Opt_mountaddr, Opt_clientaddr,
|
Opt_addr, Opt_mountaddr, Opt_clientaddr,
|
||||||
|
|
||||||
/* Mount options that are ignored */
|
/* Mount options that are ignored */
|
||||||
@@ -148,7 +148,7 @@ static match_table_t nfs_mount_option_tokens = {
|
|||||||
{ Opt_mountproto, "mountproto=%s" },
|
{ Opt_mountproto, "mountproto=%s" },
|
||||||
{ Opt_addr, "addr=%s" },
|
{ Opt_addr, "addr=%s" },
|
||||||
{ Opt_clientaddr, "clientaddr=%s" },
|
{ Opt_clientaddr, "clientaddr=%s" },
|
||||||
{ Opt_userspace, "mounthost=%s" },
|
{ Opt_mounthost, "mounthost=%s" },
|
||||||
{ Opt_mountaddr, "mountaddr=%s" },
|
{ Opt_mountaddr, "mountaddr=%s" },
|
||||||
|
|
||||||
{ Opt_err, NULL }
|
{ Opt_err, NULL }
|
||||||
@@ -974,6 +974,12 @@ static int nfs_parse_mount_options(char *raw,
|
|||||||
goto out_nomem;
|
goto out_nomem;
|
||||||
mnt->client_address = string;
|
mnt->client_address = string;
|
||||||
break;
|
break;
|
||||||
|
case Opt_mounthost:
|
||||||
|
string = match_strdup(args);
|
||||||
|
if (string == NULL)
|
||||||
|
goto out_nomem;
|
||||||
|
mnt->mount_server.hostname = string;
|
||||||
|
break;
|
||||||
case Opt_mountaddr:
|
case Opt_mountaddr:
|
||||||
string = match_strdup(args);
|
string = match_strdup(args);
|
||||||
if (string == NULL)
|
if (string == NULL)
|
||||||
@@ -1027,6 +1033,7 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args,
|
|||||||
{
|
{
|
||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
int status;
|
int status;
|
||||||
|
char *hostname;
|
||||||
|
|
||||||
if (args->mount_server.version == 0) {
|
if (args->mount_server.version == 0) {
|
||||||
if (args->flags & NFS_MOUNT_VER3)
|
if (args->flags & NFS_MOUNT_VER3)
|
||||||
@@ -1035,6 +1042,11 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args,
|
|||||||
args->mount_server.version = NFS_MNT_VERSION;
|
args->mount_server.version = NFS_MNT_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args->mount_server.hostname)
|
||||||
|
hostname = args->mount_server.hostname;
|
||||||
|
else
|
||||||
|
hostname = args->nfs_server.hostname;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Construct the mount server's address.
|
* Construct the mount server's address.
|
||||||
*/
|
*/
|
||||||
@@ -1053,7 +1065,7 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args,
|
|||||||
*/
|
*/
|
||||||
status = nfs_mount((struct sockaddr *) &sin,
|
status = nfs_mount((struct sockaddr *) &sin,
|
||||||
sizeof(sin),
|
sizeof(sin),
|
||||||
args->nfs_server.hostname,
|
hostname,
|
||||||
args->nfs_server.export_path,
|
args->nfs_server.export_path,
|
||||||
args->mount_server.version,
|
args->mount_server.version,
|
||||||
args->mount_server.protocol,
|
args->mount_server.protocol,
|
||||||
@@ -1061,8 +1073,8 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args,
|
|||||||
if (status == 0)
|
if (status == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
dfprintk(MOUNT, "NFS: unable to mount server " NIPQUAD_FMT
|
dfprintk(MOUNT, "NFS: unable to mount server %s, error %d",
|
||||||
", error %d\n", NIPQUAD(sin.sin_addr.s_addr), status);
|
hostname, status);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1468,6 +1480,7 @@ static int nfs_get_sb(struct file_system_type *fs_type,
|
|||||||
|
|
||||||
out:
|
out:
|
||||||
kfree(data.nfs_server.hostname);
|
kfree(data.nfs_server.hostname);
|
||||||
|
kfree(data.mount_server.hostname);
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
out_err_nosb:
|
out_err_nosb:
|
||||||
|
Reference in New Issue
Block a user