mirror of https://gitee.com/openkylin/linux.git
nfs: simplify nfs4_parse_monolithic
Remove a level of indentation for the version 1 mount data parsing, and simplify the NULL data case a little bit as well. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
9123e3a74e
commit
a1c7dc5d15
|
@ -1047,13 +1047,18 @@ static int nfs4_parse_monolithic(struct fs_context *fc,
|
|||
struct sockaddr *sap = (struct sockaddr *)&ctx->nfs_server.address;
|
||||
char *c;
|
||||
|
||||
if (data == NULL)
|
||||
goto out_no_data;
|
||||
if (!data) {
|
||||
if (is_remount_fc(fc))
|
||||
goto done;
|
||||
return nfs_invalf(fc,
|
||||
"NFS4: mount program didn't pass any mount data");
|
||||
}
|
||||
|
||||
ctx->version = 4;
|
||||
|
||||
switch (data->version) {
|
||||
case 1:
|
||||
if (data->version != 1)
|
||||
return generic_parse_monolithic(fc, data);
|
||||
|
||||
if (data->host_addrlen > sizeof(ctx->nfs_server.address))
|
||||
goto out_no_address;
|
||||
if (data->host_addrlen == 0)
|
||||
|
@ -1067,15 +1072,16 @@ static int nfs4_parse_monolithic(struct fs_context *fc,
|
|||
|
||||
if (data->auth_flavourlen) {
|
||||
rpc_authflavor_t pseudoflavor;
|
||||
|
||||
if (data->auth_flavourlen > 1)
|
||||
goto out_inval_auth;
|
||||
if (copy_from_user(&pseudoflavor,
|
||||
data->auth_flavours,
|
||||
if (copy_from_user(&pseudoflavor, data->auth_flavours,
|
||||
sizeof(pseudoflavor)))
|
||||
return -EFAULT;
|
||||
ctx->selected_flavor = pseudoflavor;
|
||||
} else
|
||||
} else {
|
||||
ctx->selected_flavor = RPC_AUTH_UNIX;
|
||||
}
|
||||
|
||||
c = strndup_user(data->hostname.data, NFS4_MAXNAMLEN);
|
||||
if (IS_ERR(c))
|
||||
|
@ -1111,25 +1117,10 @@ static int nfs4_parse_monolithic(struct fs_context *fc,
|
|||
nfs_validate_transport_protocol(ctx);
|
||||
if (ctx->nfs_server.protocol == XPRT_TRANSPORT_UDP)
|
||||
goto out_invalid_transport_udp;
|
||||
|
||||
break;
|
||||
default:
|
||||
goto generic;
|
||||
}
|
||||
|
||||
done:
|
||||
ctx->skip_reconfig_option_check = true;
|
||||
return 0;
|
||||
|
||||
generic:
|
||||
return generic_parse_monolithic(fc, data);
|
||||
|
||||
out_no_data:
|
||||
if (is_remount_fc(fc)) {
|
||||
ctx->skip_reconfig_option_check = true;
|
||||
return 0;
|
||||
}
|
||||
return nfs_invalf(fc, "NFS4: mount program didn't pass any mount data");
|
||||
|
||||
out_inval_auth:
|
||||
return nfs_invalf(fc, "NFS4: Invalid number of RPC auth flavours %d",
|
||||
data->auth_flavourlen);
|
||||
|
|
Loading…
Reference in New Issue