Commit 35f7a14fc1180164d6358a5885031fc187ef1bfa

Authored by J. Bruce Fields
1 parent 1c327d962f

nfsd4: fix minorversion support interface

You can turn on or off support for minorversions using e.g.

	echo "-4.2" >/proc/fs/nfsd/versions

However, the current implementation is a little wonky.  For example, the
above will turn off 4.2 support, but it will also turn *on* 4.1 support.

This didn't matter as long as we only had 2 minorversions, which was
true till very recently.

And do a little cleanup here.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>

Showing 3 changed files with 8 additions and 8 deletions Side-by-side Diff

... ... @@ -1293,7 +1293,7 @@
1293 1293 * According to RFC3010, this takes precedence over all other errors.
1294 1294 */
1295 1295 status = nfserr_minor_vers_mismatch;
1296   - if (args->minorversion > nfsd_supported_minorversion)
  1296 + if (nfsd_minorversion(args->minorversion, NFSD_TEST) <= 0)
1297 1297 goto out;
1298 1298  
1299 1299 status = nfs41_check_op_ordering(args);
... ... @@ -53,7 +53,6 @@
53 53 extern struct svc_program nfsd_program;
54 54 extern struct svc_version nfsd_version2, nfsd_version3,
55 55 nfsd_version4;
56   -extern u32 nfsd_supported_minorversion;
57 56 extern struct mutex nfsd_mutex;
58 57 extern spinlock_t nfsd_drc_lock;
59 58 extern unsigned long nfsd_drc_max_mem;
... ... @@ -116,7 +116,10 @@
116 116  
117 117 };
118 118  
119   -u32 nfsd_supported_minorversion = 1;
  119 +static bool nfsd_supported_minorversions[NFSD_SUPPORTED_MINOR_VERSION + 1] = {
  120 + [0] = 1,
  121 + [1] = 1,
  122 +};
120 123  
121 124 int nfsd_vers(int vers, enum vers_op change)
122 125 {
123 126  
124 127  
... ... @@ -151,15 +154,13 @@
151 154 return -1;
152 155 switch(change) {
153 156 case NFSD_SET:
154   - nfsd_supported_minorversion = minorversion;
  157 + nfsd_supported_minorversions[minorversion] = true;
155 158 break;
156 159 case NFSD_CLEAR:
157   - if (minorversion == 0)
158   - return -1;
159   - nfsd_supported_minorversion = minorversion - 1;
  160 + nfsd_supported_minorversions[minorversion] = false;
160 161 break;
161 162 case NFSD_TEST:
162   - return minorversion <= nfsd_supported_minorversion;
  163 + return nfsd_supported_minorversions[minorversion];
163 164 case NFSD_AVAIL:
164 165 return minorversion <= NFSD_SUPPORTED_MINOR_VERSION;
165 166 }