]> git.pld-linux.org Git - packages/nfs-utils.git/blame - fix-minorversion.patch
- fix compatibility with kernels not supporting NFS vers 4.1 and 4.2
[packages/nfs-utils.git] / fix-minorversion.patch
CommitLineData
f47abd79
JR
1From: "J. Bruce Fields" <bfields@redhat.com>
2
3By unconditionally adding +/-4.2 to the version string written to the
4kernel we make nfs-utils incompatible with pre-4.2-supporting kernels.
5
6Ditto for 4.1. This problem was introduced by
712a590f8d556c00a9502eeebaa763d906222d521 "rpc.nfsd: Allow v4.2 server
8support with the -V option", which also change nfsd to unconditionally
9pass +/-4.2.
10
11Instead, just don't mention 4.1 or 4.2 unless the commandline has
12specifically requested that one or the other be turned on or off.
13
14Tested-by: Joakim Tjernlund <joakim.tjernlund@transmode.se>
15Reported-by: Joakim Tjernlund <joakim.tjernlund@transmode.se>
16Signed-off-by: J. Bruce Fields <bfields@redhat.com>
17---
18 support/include/nfs/nfs.h | 1 -
19 utils/nfsd/nfsd.c | 6 +++---
20 utils/nfsd/nfssvc.c | 6 +++---
21 utils/nfsd/nfssvc.h | 2 +-
22 4 files changed, 7 insertions(+), 8 deletions(-)
23
24diff --git a/support/include/nfs/nfs.h b/support/include/nfs/nfs.h
25index 38db5b5..df4ad76 100644
26--- a/support/include/nfs/nfs.h
27+++ b/support/include/nfs/nfs.h
28@@ -17,7 +17,6 @@
29
30 #define NFS4_MINMINOR 1
31 #define NFS4_MAXMINOR 2
32-#define NFS4_VERDEFAULT 0x1 /* minor verion 1 */
33
34 struct nfs_fh_len {
35 int fh_size;
36diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
37index 6db92f0..a9d77ab 100644
38--- a/utils/nfsd/nfsd.c
39+++ b/utils/nfsd/nfsd.c
40@@ -99,7 +99,7 @@ main(int argc, char **argv)
41 char *p, *progname, *port;
42 char *haddr = NULL;
43 int socket_up = 0;
44- int minorvers = NFS4_VERDEFAULT; /* nfsv4 minor version */
45+ int minorvers[NFS4_MAXMINOR + 1] = {0};
46 unsigned int versbits = NFSCTL_VERDEFAULT;
47 unsigned int protobits = NFSCTL_ALLBITS;
48 unsigned int proto4 = 0;
49@@ -164,7 +164,7 @@ main(int argc, char **argv)
50 fprintf(stderr, "%s: unsupported minor version\n", optarg);
51 exit(1);
52 }
53- NFSCTL_VERUNSET(minorvers, i);
54+ minorvers[i] = -1;
55 break;
56 }
57 case 3:
58@@ -185,7 +185,7 @@ main(int argc, char **argv)
59 fprintf(stderr, "%s: unsupported minor version\n", optarg);
60 exit(1);
61 }
62- NFSCTL_VERSET(minorvers, i);
63+ minorvers[i] = 1;
64 break;
65 }
66 case 3:
67diff --git a/utils/nfsd/nfssvc.c b/utils/nfsd/nfssvc.c
68index 8b85846..1b50aba 100644
69--- a/utils/nfsd/nfssvc.c
70+++ b/utils/nfsd/nfssvc.c
71@@ -269,7 +269,7 @@ nfssvc_set_sockets(const int family, const unsigned int protobits,
72 }
73
74 void
75-nfssvc_setvers(unsigned int ctlbits, int minorvers)
76+nfssvc_setvers(unsigned int ctlbits, int minorvers[])
77 {
78 int fd, n, off;
79 char *ptr;
80@@ -281,9 +281,9 @@ nfssvc_setvers(unsigned int ctlbits, int minorvers)
81 return;
82
83 for (n = NFS4_MINMINOR; n <= NFS4_MAXMINOR; n++) {
84- if (NFSCTL_VERISSET(minorvers, n))
85+ if (minorvers[n] == 1)
86 off += snprintf(ptr+off, sizeof(buf) - off, "+4.%d ", n);
87- else
88+ else if (minorvers[n] == -1)
89 off += snprintf(ptr+off, sizeof(buf) - off, "-4.%d ", n);
90 }
91 for (n = NFSD_MINVERS; n <= NFSD_MAXVERS; n++) {
92diff --git a/utils/nfsd/nfssvc.h b/utils/nfsd/nfssvc.h
93index 08de0fe..2bbd3d3 100644
94--- a/utils/nfsd/nfssvc.h
95+++ b/utils/nfsd/nfssvc.h
96@@ -24,5 +24,5 @@ void nfssvc_mount_nfsdfs(char *progname);
97 int nfssvc_inuse(void);
98 int nfssvc_set_sockets(const int family, const unsigned int protobits,
99 const char *host, const char *port);
100-void nfssvc_setvers(unsigned int ctlbits, int minorvers4);
101+void nfssvc_setvers(unsigned int ctlbits, int minorvers4[]);
102 int nfssvc_threads(unsigned short port, int nrservs);
103--
1041.8.3.1
105
106--
107To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
108the body of a message to majordomo@vger.kernel.org
109More majordomo info at http://vger.kernel.org/majordomo-info.html
This page took 0.116091 seconds and 4 git commands to generate.