NFS: Allow the mount option retrans=0
We should allow retrans=0 as just meaning that every timeout is a major timeout, and that there is no increment in the timeout value. For instance, this means that we would allow TCP users to specify a flat timeout value of 60s, by specifying "timeo=600,retrans=0" in their mount option string. Siged-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
This commit is contained in:
@@ -923,6 +923,8 @@ static struct nfs_parsed_mount_data *nfs_alloc_parsed_mount_data(void)
|
||||
|
||||
data = kzalloc(sizeof(*data), GFP_KERNEL);
|
||||
if (data) {
|
||||
data->timeo = NFS_UNSPEC_TIMEO;
|
||||
data->retrans = NFS_UNSPEC_RETRANS;
|
||||
data->acregmin = NFS_DEF_ACREGMIN;
|
||||
data->acregmax = NFS_DEF_ACREGMAX;
|
||||
data->acdirmin = NFS_DEF_ACDIRMIN;
|
||||
@@ -1189,6 +1191,19 @@ static int nfs_get_option_ul(substring_t args[], unsigned long *option)
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int nfs_get_option_ul_bound(substring_t args[], unsigned long *option,
|
||||
unsigned long l_bound, unsigned long u_bound)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = nfs_get_option_ul(args, option);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
if (*option < l_bound || *option > u_bound)
|
||||
return -ERANGE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Error-check and convert a string of mount options from user space into
|
||||
* a data structure. The whole mount string is processed; bad options are
|
||||
@@ -1352,12 +1367,12 @@ static int nfs_parse_mount_options(char *raw,
|
||||
mnt->bsize = option;
|
||||
break;
|
||||
case Opt_timeo:
|
||||
if (nfs_get_option_ul(args, &option) || option == 0)
|
||||
if (nfs_get_option_ul_bound(args, &option, 1, INT_MAX))
|
||||
goto out_invalid_value;
|
||||
mnt->timeo = option;
|
||||
break;
|
||||
case Opt_retrans:
|
||||
if (nfs_get_option_ul(args, &option) || option == 0)
|
||||
if (nfs_get_option_ul_bound(args, &option, 0, INT_MAX))
|
||||
goto out_invalid_value;
|
||||
mnt->retrans = option;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user