1 |
radhermit 13/07/26 00:31:38 |
2 |
|
3 |
Added: 0001-mountd-Fix-is_subdirectory-again.patch |
4 |
0001-statd-exit-if-a-statd-is-already-running.patch |
5 |
nfs-utils-1.2.8-cross-build.patch |
6 |
Log: |
7 |
Version bump. |
8 |
|
9 |
(Portage version: 2.2.0_alpha188/cvs/Linux x86_64, signed Manifest commit with key 4AB3E85B4F064CA3) |
10 |
|
11 |
Revision Changes Path |
12 |
1.1 net-fs/nfs-utils/files/0001-mountd-Fix-is_subdirectory-again.patch |
13 |
|
14 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-fs/nfs-utils/files/0001-mountd-Fix-is_subdirectory-again.patch?rev=1.1&view=markup |
15 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-fs/nfs-utils/files/0001-mountd-Fix-is_subdirectory-again.patch?rev=1.1&content-type=text/plain |
16 |
|
17 |
Index: 0001-mountd-Fix-is_subdirectory-again.patch |
18 |
=================================================================== |
19 |
From 23d3980b6cfea4e9056d9b7b81e48b4fefc645e0 Mon Sep 17 00:00:00 2001 |
20 |
From: NeilBrown <neilb@××××.de> |
21 |
Date: Tue, 7 May 2013 11:46:18 -0400 |
22 |
Subject: [PATCH] mountd: Fix is_subdirectory again |
23 |
|
24 |
The problem was that is_subdirectory() would also succeed if the two |
25 |
directories were the same. This is needed for path_matches() which |
26 |
needs to see if the child is same-or-descendant. |
27 |
|
28 |
So this patch rearranges path_matches() to do the "are they the same" |
29 |
test itself and only bother with is_subdirectory() if it they are not |
30 |
the same. |
31 |
|
32 |
So now is_subdirectory() can be strict, and so can be usable for |
33 |
subexport(), which needs a strong 'in subdirectory - not the same' test. |
34 |
|
35 |
Acked-by: J. Bruce Fields <bfields@××××××.com> |
36 |
Signed-off-by: NeilBrown <neilb@××××.de> |
37 |
Signed-off-by: Steve Dickson <steved@××××××.com> |
38 |
--- |
39 |
utils/mountd/cache.c | 24 ++++++++++++++---------- |
40 |
1 file changed, 14 insertions(+), 10 deletions(-) |
41 |
|
42 |
diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c |
43 |
index 737927c..517aa62 100644 |
44 |
--- a/utils/mountd/cache.c |
45 |
+++ b/utils/mountd/cache.c |
46 |
@@ -347,20 +347,26 @@ static char *next_mnt(void **v, char *p) |
47 |
|
48 |
static int is_subdirectory(char *child, char *parent) |
49 |
{ |
50 |
+ /* Check is child is strictly a subdirectory of |
51 |
+ * parent or a more distant descendant. |
52 |
+ */ |
53 |
size_t l = strlen(parent); |
54 |
|
55 |
- if (strcmp(parent, "/") == 0) |
56 |
+ if (strcmp(parent, "/") == 0 && child[1] != 0) |
57 |
return 1; |
58 |
|
59 |
- return strcmp(child, parent) == 0 |
60 |
- || (strncmp(child, parent, l) == 0 && child[l] == '/'); |
61 |
+ return (strncmp(child, parent, l) == 0 && child[l] == '/'); |
62 |
} |
63 |
|
64 |
static int path_matches(nfs_export *exp, char *path) |
65 |
{ |
66 |
- if (exp->m_export.e_flags & NFSEXP_CROSSMOUNT) |
67 |
- return is_subdirectory(path, exp->m_export.e_path); |
68 |
- return strcmp(path, exp->m_export.e_path) == 0; |
69 |
+ /* Does the path match the export? I.e. is it an |
70 |
+ * exact match, or does the export have CROSSMOUNT, and path |
71 |
+ * is a descendant? |
72 |
+ */ |
73 |
+ return strcmp(path, exp->m_export.e_path) == 0 |
74 |
+ || ((exp->m_export.e_flags & NFSEXP_CROSSMOUNT) |
75 |
+ && is_subdirectory(path, exp->m_export.e_path)); |
76 |
} |
77 |
|
78 |
static int |
79 |
@@ -369,15 +375,13 @@ export_matches(nfs_export *exp, char *dom, char *path, struct addrinfo *ai) |
80 |
return path_matches(exp, path) && client_matches(exp, dom, ai); |
81 |
} |
82 |
|
83 |
-/* True iff e1 is a child of e2 and e2 has crossmnt set: */ |
84 |
+/* True iff e1 is a child of e2 (or descendant) and e2 has crossmnt set: */ |
85 |
static bool subexport(struct exportent *e1, struct exportent *e2) |
86 |
{ |
87 |
char *p1 = e1->e_path, *p2 = e2->e_path; |
88 |
- size_t l2 = strlen(p2); |
89 |
|
90 |
return e2->e_flags & NFSEXP_CROSSMOUNT |
91 |
- && strncmp(p1, p2, l2) == 0 |
92 |
- && p1[l2] == '/'; |
93 |
+ && is_subdirectory(p1, p2); |
94 |
} |
95 |
|
96 |
struct parsed_fsid { |
97 |
-- |
98 |
1.8.3.2 |
99 |
|
100 |
|
101 |
|
102 |
|
103 |
1.1 net-fs/nfs-utils/files/0001-statd-exit-if-a-statd-is-already-running.patch |
104 |
|
105 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-fs/nfs-utils/files/0001-statd-exit-if-a-statd-is-already-running.patch?rev=1.1&view=markup |
106 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-fs/nfs-utils/files/0001-statd-exit-if-a-statd-is-already-running.patch?rev=1.1&content-type=text/plain |
107 |
|
108 |
Index: 0001-statd-exit-if-a-statd-is-already-running.patch |
109 |
=================================================================== |
110 |
From 342446a4a624d4ee8254af859bb7f1de6d268679 Mon Sep 17 00:00:00 2001 |
111 |
From: Weston Andros Adamson <dros@××××××.com> |
112 |
Date: Tue, 7 May 2013 11:25:29 -0400 |
113 |
Subject: [PATCH] statd: exit if a statd is already running |
114 |
|
115 |
Moves nfs_probe_statd from mount to nfs support lib to share with statd. |
116 |
|
117 |
Acked-by: Chuck Lever <chuck.lever@××××××.com> |
118 |
Signed-off-by: Weston Andros Adamson <dros@××××××.com> |
119 |
Signed-off-by: Steve Dickson <steved@××××××.com> |
120 |
--- |
121 |
support/include/nfsrpc.h | 5 +++++ |
122 |
support/nfs/getport.c | 22 ++++++++++++++++++++++ |
123 |
utils/mount/network.c | 17 ----------------- |
124 |
utils/statd/statd.c | 7 +++++++ |
125 |
4 files changed, 34 insertions(+), 17 deletions(-) |
126 |
|
127 |
diff --git a/support/include/nfsrpc.h b/support/include/nfsrpc.h |
128 |
index a0b80e1..1bfae7a 100644 |
129 |
--- a/support/include/nfsrpc.h |
130 |
+++ b/support/include/nfsrpc.h |
131 |
@@ -156,6 +156,11 @@ extern unsigned long nfs_pmap_getport(const struct sockaddr_in *, |
132 |
const struct timeval *); |
133 |
|
134 |
/* |
135 |
+ * Use nfs_pmap_getport to see if statd is running locally |
136 |
+ */ |
137 |
+extern int nfs_probe_statd(void); |
138 |
+ |
139 |
+/* |
140 |
* Contact a remote RPC service to discover whether it is responding |
141 |
* to requests. |
142 |
*/ |
143 |
diff --git a/support/nfs/getport.c b/support/nfs/getport.c |
144 |
index 3331ad4..081594c 100644 |
145 |
--- a/support/nfs/getport.c |
146 |
+++ b/support/nfs/getport.c |
147 |
@@ -1102,3 +1102,25 @@ unsigned long nfs_pmap_getport(const struct sockaddr_in *sin, |
148 |
|
149 |
return port; |
150 |
} |
151 |
+ |
152 |
+static const char *nfs_ns_pgmtbl[] = { |
153 |
+ "status", |
154 |
+ NULL, |
155 |
+}; |
156 |
+ |
157 |
+/* |
158 |
+ * nfs_probe_statd - use nfs_pmap_getport to see if statd is running locally |
159 |
+ * |
160 |
+ * Returns non-zero if statd is running locally. |
161 |
+ */ |
162 |
+int nfs_probe_statd(void) |
163 |
+{ |
164 |
+ struct sockaddr_in addr = { |
165 |
+ .sin_family = AF_INET, |
166 |
+ .sin_addr.s_addr = htonl(INADDR_LOOPBACK), |
167 |
+ }; |
168 |
+ rpcprog_t program = nfs_getrpcbyname(NSMPROG, nfs_ns_pgmtbl); |
169 |
+ |
170 |
+ return nfs_getport_ping((struct sockaddr *)(char *)&addr, sizeof(addr), |
171 |
+ program, (rpcvers_t)1, IPPROTO_UDP); |
172 |
+} |
173 |
diff --git a/utils/mount/network.c b/utils/mount/network.c |
174 |
index 4be48cd..e2cdcaf 100644 |
175 |
--- a/utils/mount/network.c |
176 |
+++ b/utils/mount/network.c |
177 |
@@ -65,11 +65,6 @@ extern int nfs_mount_data_version; |
178 |
extern char *progname; |
179 |
extern int verbose; |
180 |
|
181 |
-static const char *nfs_ns_pgmtbl[] = { |
182 |
- "status", |
183 |
- NULL, |
184 |
-}; |
185 |
- |
186 |
static const char *nfs_mnt_pgmtbl[] = { |
187 |
"mount", |
188 |
"mountd", |
189 |
@@ -761,18 +756,6 @@ int probe_bothports(clnt_addr_t *mnt_server, clnt_addr_t *nfs_server) |
190 |
&nfs_server->pmap); |
191 |
} |
192 |
|
193 |
-static int nfs_probe_statd(void) |
194 |
-{ |
195 |
- struct sockaddr_in addr = { |
196 |
- .sin_family = AF_INET, |
197 |
- .sin_addr.s_addr = htonl(INADDR_LOOPBACK), |
198 |
- }; |
199 |
- rpcprog_t program = nfs_getrpcbyname(NSMPROG, nfs_ns_pgmtbl); |
200 |
- |
201 |
- return nfs_getport_ping(SAFE_SOCKADDR(&addr), sizeof(addr), |
202 |
- program, (rpcvers_t)1, IPPROTO_UDP); |
203 |
-} |
204 |
- |
205 |
/** |
206 |
* start_statd - attempt to start rpc.statd |
207 |
* |
208 |
diff --git a/utils/statd/statd.c b/utils/statd/statd.c |
209 |
index 652546c..8c51bcc 100644 |
210 |
--- a/utils/statd/statd.c |
211 |
+++ b/utils/statd/statd.c |
212 |
@@ -28,6 +28,7 @@ |
213 |
|
214 |
#include "statd.h" |
215 |
#include "nfslib.h" |
216 |
+#include "nfsrpc.h" |
217 |
#include "nsm.h" |
218 |
|
219 |
/* Socket operations */ |
220 |
@@ -237,6 +238,12 @@ int main (int argc, char **argv) |
221 |
/* Set hostname */ |
222 |
MY_NAME = NULL; |
223 |
|
224 |
+ /* Refuse to start if another statd is running */ |
225 |
+ if (nfs_probe_statd()) { |
226 |
+ fprintf(stderr, "Statd service already running!\n"); |
227 |
+ exit(1); |
228 |
+ } |
229 |
+ |
230 |
/* Process command line switches */ |
231 |
while ((arg = getopt_long(argc, argv, "h?vVFNH:dn:p:o:P:L", longopts, NULL)) != EOF) { |
232 |
switch (arg) { |
233 |
-- |
234 |
1.8.3.2 |
235 |
|
236 |
|
237 |
|
238 |
|
239 |
1.1 net-fs/nfs-utils/files/nfs-utils-1.2.8-cross-build.patch |
240 |
|
241 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-fs/nfs-utils/files/nfs-utils-1.2.8-cross-build.patch?rev=1.1&view=markup |
242 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-fs/nfs-utils/files/nfs-utils-1.2.8-cross-build.patch?rev=1.1&content-type=text/plain |
243 |
|
244 |
Index: nfs-utils-1.2.8-cross-build.patch |
245 |
=================================================================== |
246 |
this is kind of hacky, but automake doesn't make this easy |
247 |
for us atm, so hack away :( |
248 |
|
249 |
(recent autotools will always add $(CFLAGS)/etc... to the compile) |
250 |
|
251 |
--- a/tools/locktest/Makefile.am |
252 |
+++ b/tools/locktest/Makefile.am |
253 |
@@ -1,12 +1,11 @@ |
254 |
## Process this file with automake to produce Makefile.in |
255 |
|
256 |
CC=$(CC_FOR_BUILD) |
257 |
-LIBTOOL = @LIBTOOL@ --tag=CC |
258 |
+CFLAGS=$(CFLAGS_FOR_BUILD) |
259 |
+CPPFLAGS=$(CPPFLAGS_FOR_BUILD) |
260 |
+LDFLAGS=$(LDFLAGS_FOR_BUILD) |
261 |
|
262 |
noinst_PROGRAMS = testlk |
263 |
testlk_SOURCES = testlk.c |
264 |
-testlk_CFLAGS=$(CFLAGS_FOR_BUILD) |
265 |
-testlk_CPPFLAGS=$(CPPFLAGS_FOR_BUILD) |
266 |
-testlk_LDFLAGS=$(LDFLAGS_FOR_BUILD) |
267 |
|
268 |
MAINTAINERCLEANFILES = Makefile.in |
269 |
--- a/tools/rpcgen/Makefile.am |
270 |
+++ b/tools/rpcgen/Makefile.am |
271 |
@@ -1,7 +1,9 @@ |
272 |
## Process this file with automake to produce Makefile.in |
273 |
|
274 |
CC=$(CC_FOR_BUILD) |
275 |
-LIBTOOL = @LIBTOOL@ --tag=CC |
276 |
+CFLAGS=$(CFLAGS_FOR_BUILD) |
277 |
+CPPFLAGS=$(CPPFLAGS_FOR_BUILD) |
278 |
+LDFLAGS=$(LDFLAGS_FOR_BUILD) |
279 |
|
280 |
noinst_PROGRAMS = rpcgen |
281 |
rpcgen_SOURCES = rpc_clntout.c rpc_cout.c rpc_hout.c rpc_main.c \ |
282 |
@@ -9,10 +11,6 @@ |
283 |
rpc_util.c rpc_sample.c rpc_output.h rpc_parse.h \ |
284 |
rpc_scan.h rpc_util.h |
285 |
|
286 |
-rpcgen_CFLAGS=$(CFLAGS_FOR_BUILD) |
287 |
-rpcgen_CPPLAGS=$(CPPFLAGS_FOR_BUILD) |
288 |
-rpcgen_LDFLAGS=$(LDFLAGS_FOR_BUILD) |
289 |
-rpcgen_LDADD=$(LIBTIRPC) |
290 |
|
291 |
MAINTAINERCLEANFILES = Makefile.in |
292 |
|
293 |
EXTRA_DIST = rpcgen.new.1 |