Commit 800a938f authored by NeilBrown's avatar NeilBrown Committed by J. Bruce Fields

NFSD: fix nfsd_reset_versions for NFSv4.

If you write "-2 -3 -4" to the "versions" file, it will
notice that no versions are enabled, and nfsd_reset_versions()
is called.
This enables all major versions, not no minor versions.
So we lose the invariant that NFSv4 is only advertised when
at least one minor is enabled.

Fix the code to explicitly enable minor versions for v4,
change it to use nfsd_vers() to test and set, and simplify
the code.
Signed-off-by: default avatarNeilBrown <neilb@suse.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 928c6fb3
...@@ -416,22 +416,19 @@ static void nfsd_last_thread(struct svc_serv *serv, struct net *net) ...@@ -416,22 +416,19 @@ static void nfsd_last_thread(struct svc_serv *serv, struct net *net)
void nfsd_reset_versions(void) void nfsd_reset_versions(void)
{ {
int found_one = 0;
int i; int i;
for (i = NFSD_MINVERS; i < NFSD_NRVERS; i++) { for (i = 0; i < NFSD_NRVERS; i++)
if (nfsd_program.pg_vers[i]) if (nfsd_vers(i, NFSD_TEST))
found_one = 1; return;
}
if (!found_one) { for (i = 0; i < NFSD_NRVERS; i++)
for (i = NFSD_MINVERS; i < NFSD_NRVERS; i++) if (i != 4)
nfsd_program.pg_vers[i] = nfsd_version[i]; nfsd_vers(i, NFSD_SET);
#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) else {
for (i = NFSD_ACL_MINVERS; i < NFSD_ACL_NRVERS; i++) int minor = 0;
nfsd_acl_program.pg_vers[i] = while (nfsd_minorversion(minor, NFSD_SET) >= 0)
nfsd_acl_version[i]; minor++;
#endif
} }
} }
......
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