public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] nfsd: fix version-setting regression on old kernels
@ 2010-01-27 22:26 J. Bruce Fields
  2010-01-27 22:26 ` [PATCH 2/2] nfsd: default to kernel default for minorversion 1 J. Bruce Fields
  2010-02-04 21:37 ` [PATCH 1/2] nfsd: fix version-setting regression on old kernels Steve Dickson
  0 siblings, 2 replies; 18+ messages in thread
From: J. Bruce Fields @ 2010-01-27 22:26 UTC (permalink / raw)
  To: Steve Dickson; +Cc: linux-nfs, J. Bruce Fields

/proc/fs/nfsd/versions was extended to allow turning on/off minor
versions by echoing "+4.1" or "-4.1" to /proc/fs/nsfd/versions.

Unfortunately, pre-2.6.30 kernels just stop parsing at first non-digit,
so "-4.1" is interpreted as "-4".  If new nfs-utils (on old kernel)
writes "+2", "+3", "+4", then "-4.1", result therefore is to turn off
4.1.

Given that historical behavior, it may have been a mistake to extend the
interface the way we did; but at this point we're probably stuck with
it.  So, just reverse the order we write versions in.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
---
 utils/nfsd/nfssvc.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/utils/nfsd/nfssvc.c b/utils/nfsd/nfssvc.c
index b8028bb..7bbbaba 100644
--- a/utils/nfsd/nfssvc.c
+++ b/utils/nfsd/nfssvc.c
@@ -238,17 +238,17 @@ nfssvc_setvers(unsigned int ctlbits, int minorvers4)
 	if (fd < 0)
 		return;
 
+	n = minorvers4 >= 0 ? minorvers4 : -minorvers4;
+	if (n >= NFSD_MINMINORVERS4 && n <= NFSD_MAXMINORVERS4)
+		    off += snprintf(ptr+off, sizeof(buf) - off, "%c4.%d",
+				    minorvers4 > 0 ? '+' : '-',
+				    n);
 	for (n = NFSD_MINVERS; n <= NFSD_MAXVERS; n++) {
 		if (NFSCTL_VERISSET(ctlbits, n))
 		    off += snprintf(ptr+off, sizeof(buf) - off, "+%d ", n);
 		else
 		    off += snprintf(ptr+off, sizeof(buf) - off, "-%d ", n);
 	}
-	n = minorvers4 >= 0 ? minorvers4 : -minorvers4;
-	if (n >= NFSD_MINMINORVERS4 && n <= NFSD_MAXMINORVERS4)
-		    off += snprintf(ptr+off, sizeof(buf) - off, "%c4.%d",
-				    minorvers4 > 0 ? '+' : '-',
-				    n);
 	xlog(D_GENERAL, "Writing version string to kernel: %s", buf);
 	snprintf(ptr+off, sizeof(buf) - off, "\n");
 	if (write(fd, buf, strlen(buf)) != strlen(buf))
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2010-02-19  2:06 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-27 22:26 [PATCH 1/2] nfsd: fix version-setting regression on old kernels J. Bruce Fields
2010-01-27 22:26 ` [PATCH 2/2] nfsd: default to kernel default for minorversion 1 J. Bruce Fields
2010-02-01 19:58   ` J. Bruce Fields
2010-02-04 22:19     ` Steve Dickson
     [not found]       ` <4B6B480C.1050307-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org>
2010-02-05 16:10         ` J. Bruce Fields
2010-02-05 19:28           ` J. Bruce Fields
2010-02-05 20:05             ` [PATCH] " J. Bruce Fields
2010-02-12 19:58               ` Steve Dickson
2010-02-12 20:05                 ` J. Bruce Fields
2010-02-12 21:44                   ` Steve Dickson
2010-02-12 21:55                     ` J. Bruce Fields
2010-02-17 19:46                       ` Steve Dickson
     [not found]                         ` <4B7C47A2.4010100-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org>
2010-02-18 12:07                           ` Steve Dickson
2010-02-19  2:07                           ` J. Bruce Fields
2010-02-04 21:37 ` [PATCH 1/2] nfsd: fix version-setting regression on old kernels Steve Dickson
     [not found]   ` <4B6B3E30.8090907-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org>
2010-02-04 21:47     ` J. Bruce Fields
2010-02-04 22:06       ` Steve Dickson
     [not found]         ` <4B6B44EA.7060602-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org>
2010-02-04 22:16           ` J. Bruce Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox