Commit 1c3695d0 authored by Trond Myklebust's avatar Trond Myklebust

NFS: Switch mount code to use xprt_find_transport_ident()

Switch the mount code to use xprt_find_transport_ident() and to check
the results before allowing the mount to proceed.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 1fc5f131
...@@ -510,13 +510,12 @@ static int nfs_fs_context_parse_param(struct fs_context *fc, ...@@ -510,13 +510,12 @@ static int nfs_fs_context_parse_param(struct fs_context *fc,
ctx->nfs_server.protocol = XPRT_TRANSPORT_UDP; ctx->nfs_server.protocol = XPRT_TRANSPORT_UDP;
break; break;
case Opt_tcp: case Opt_tcp:
ctx->flags |= NFS_MOUNT_TCP;
ctx->nfs_server.protocol = XPRT_TRANSPORT_TCP;
break;
case Opt_rdma: case Opt_rdma:
ctx->flags |= NFS_MOUNT_TCP; /* for side protocols */ ctx->flags |= NFS_MOUNT_TCP; /* for side protocols */
ctx->nfs_server.protocol = XPRT_TRANSPORT_RDMA; ret = xprt_find_transport_ident(param->key);
xprt_load_transport(param->key); if (ret < 0)
goto out_bad_transport;
ctx->nfs_server.protocol = ret;
break; break;
case Opt_acl: case Opt_acl:
if (result.negated) if (result.negated)
...@@ -670,11 +669,13 @@ static int nfs_fs_context_parse_param(struct fs_context *fc, ...@@ -670,11 +669,13 @@ static int nfs_fs_context_parse_param(struct fs_context *fc,
case Opt_xprt_rdma: case Opt_xprt_rdma:
/* vector side protocols to TCP */ /* vector side protocols to TCP */
ctx->flags |= NFS_MOUNT_TCP; ctx->flags |= NFS_MOUNT_TCP;
ctx->nfs_server.protocol = XPRT_TRANSPORT_RDMA; ret = xprt_find_transport_ident(param->string);
xprt_load_transport(param->string); if (ret < 0)
goto out_bad_transport;
ctx->nfs_server.protocol = ret;
break; break;
default: default:
return nfs_invalf(fc, "NFS: Unrecognized transport protocol"); goto out_bad_transport;
} }
ctx->protofamily = protofamily; ctx->protofamily = protofamily;
...@@ -697,7 +698,7 @@ static int nfs_fs_context_parse_param(struct fs_context *fc, ...@@ -697,7 +698,7 @@ static int nfs_fs_context_parse_param(struct fs_context *fc,
break; break;
case Opt_xprt_rdma: /* not used for side protocols */ case Opt_xprt_rdma: /* not used for side protocols */
default: default:
return nfs_invalf(fc, "NFS: Unrecognized transport protocol"); goto out_bad_transport;
} }
ctx->mountfamily = mountfamily; ctx->mountfamily = mountfamily;
break; break;
...@@ -787,6 +788,8 @@ static int nfs_fs_context_parse_param(struct fs_context *fc, ...@@ -787,6 +788,8 @@ static int nfs_fs_context_parse_param(struct fs_context *fc,
return nfs_invalf(fc, "NFS: Bad IP address specified"); return nfs_invalf(fc, "NFS: Bad IP address specified");
out_of_bounds: out_of_bounds:
return nfs_invalf(fc, "NFS: Value for '%s' out of range", param->key); return nfs_invalf(fc, "NFS: Value for '%s' out of range", param->key);
out_bad_transport:
return nfs_invalf(fc, "NFS: Unrecognized transport protocol");
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment