summaryrefslogtreecommitdiffstats
path: root/fs/afs/cmservice.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2017-11-02 11:27:45 -0400
committerDavid Howells <dhowells@redhat.com>2017-11-13 10:38:16 -0500
commitf044c8847bb61eff5e1e95b6f6bb950e7f4a73a4 (patch)
tree412d51db7427f56e7aaef68c8bfe5714879cff88 /fs/afs/cmservice.c
parent5e4def20381678ba3ce0a4e117f97e378ecd81bc (diff)
afs: Lay the groundwork for supporting network namespaces
Lay the groundwork for supporting network namespaces (netns) to the AFS filesystem by moving various global features to a network-namespace struct (afs_net) and providing an instance of this as a temporary global variable that everything uses via accessor functions for the moment. The following changes have been made: (1) Store the netns in the superblock info. This will be obtained from the mounter's nsproxy on a manual mount and inherited from the parent superblock on an automount. (2) The cell list is made per-netns. It can be viewed through /proc/net/afs/cells and also be modified by writing commands to that file. (3) The local workstation cell is set per-ns in /proc/net/afs/rootcell. This is unset by default. (4) The 'rootcell' module parameter, which sets a cell and VL server list modifies the init net namespace, thereby allowing an AFS root fs to be theoretically used. (5) The volume location lists and the file lock manager are made per-netns. (6) The AF_RXRPC socket and associated I/O bits are made per-ns. The various workqueues remain global for the moment. Changes still to be made: (1) /proc/fs/afs/ should be moved to /proc/net/afs/ and a symlink emplaced from the old name. (2) A per-netns subsys needs to be registered for AFS into which it can store its per-netns data. (3) Rather than the AF_RXRPC socket being opened on module init, it needs to be opened on the creation of a superblock in that netns. (4) The socket needs to be closed when the last superblock using it is destroyed and all outstanding client calls on it have been completed. This prevents a reference loop on the namespace. (5) It is possible that several namespaces will want to use AFS, in which case each one will need its own UDP port. These can either be set through /proc/net/afs/cm_port or the kernel can pick one at random. The init_ns gets 7001 by default. Other issues that need resolving: (1) The DNS keyring needs net-namespacing. (2) Where do upcalls go (eg. DNS request-key upcall)? (3) Need something like open_socket_in_file_ns() syscall so that AFS command line tools attempting to operate on an AFS file/volume have their RPC calls go to the right place. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/afs/cmservice.c')
-rw-r--r--fs/afs/cmservice.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c
index 782d4d05a53b..30ce4be4165f 100644
--- a/fs/afs/cmservice.c
+++ b/fs/afs/cmservice.c
@@ -193,7 +193,7 @@ static int afs_deliver_cb_callback(struct afs_call *call)
193 193
194 switch (call->unmarshall) { 194 switch (call->unmarshall) {
195 case 0: 195 case 0:
196 rxrpc_kernel_get_peer(afs_socket, call->rxcall, &srx); 196 rxrpc_kernel_get_peer(call->net->socket, call->rxcall, &srx);
197 call->offset = 0; 197 call->offset = 0;
198 call->unmarshall++; 198 call->unmarshall++;
199 199
@@ -290,7 +290,7 @@ static int afs_deliver_cb_callback(struct afs_call *call)
290 290
291 /* we'll need the file server record as that tells us which set of 291 /* we'll need the file server record as that tells us which set of
292 * vnodes to operate upon */ 292 * vnodes to operate upon */
293 server = afs_find_server(&srx); 293 server = afs_find_server(call->net, &srx);
294 if (!server) 294 if (!server)
295 return -ENOTCONN; 295 return -ENOTCONN;
296 call->server = server; 296 call->server = server;
@@ -324,7 +324,7 @@ static int afs_deliver_cb_init_call_back_state(struct afs_call *call)
324 324
325 _enter(""); 325 _enter("");
326 326
327 rxrpc_kernel_get_peer(afs_socket, call->rxcall, &srx); 327 rxrpc_kernel_get_peer(call->net->socket, call->rxcall, &srx);
328 328
329 ret = afs_extract_data(call, NULL, 0, false); 329 ret = afs_extract_data(call, NULL, 0, false);
330 if (ret < 0) 330 if (ret < 0)
@@ -335,7 +335,7 @@ static int afs_deliver_cb_init_call_back_state(struct afs_call *call)
335 335
336 /* we'll need the file server record as that tells us which set of 336 /* we'll need the file server record as that tells us which set of
337 * vnodes to operate upon */ 337 * vnodes to operate upon */
338 server = afs_find_server(&srx); 338 server = afs_find_server(call->net, &srx);
339 if (!server) 339 if (!server)
340 return -ENOTCONN; 340 return -ENOTCONN;
341 call->server = server; 341 call->server = server;
@@ -357,7 +357,7 @@ static int afs_deliver_cb_init_call_back_state3(struct afs_call *call)
357 357
358 _enter(""); 358 _enter("");
359 359
360 rxrpc_kernel_get_peer(afs_socket, call->rxcall, &srx); 360 rxrpc_kernel_get_peer(call->net->socket, call->rxcall, &srx);
361 361
362 _enter("{%u}", call->unmarshall); 362 _enter("{%u}", call->unmarshall);
363 363
@@ -407,7 +407,7 @@ static int afs_deliver_cb_init_call_back_state3(struct afs_call *call)
407 407
408 /* we'll need the file server record as that tells us which set of 408 /* we'll need the file server record as that tells us which set of
409 * vnodes to operate upon */ 409 * vnodes to operate upon */
410 server = afs_find_server(&srx); 410 server = afs_find_server(call->net, &srx);
411 if (!server) 411 if (!server)
412 return -ENOTCONN; 412 return -ENOTCONN;
413 call->server = server; 413 call->server = server;
@@ -461,7 +461,7 @@ static void SRXAFSCB_ProbeUuid(struct work_struct *work)
461 461
462 _enter(""); 462 _enter("");
463 463
464 if (memcmp(r, &afs_uuid, sizeof(afs_uuid)) == 0) 464 if (memcmp(r, &call->net->uuid, sizeof(call->net->uuid)) == 0)
465 reply.match = htonl(0); 465 reply.match = htonl(0);
466 else 466 else
467 reply.match = htonl(1); 467 reply.match = htonl(1);
@@ -568,13 +568,13 @@ static void SRXAFSCB_TellMeAboutYourself(struct work_struct *work)
568 memset(&reply, 0, sizeof(reply)); 568 memset(&reply, 0, sizeof(reply));
569 reply.ia.nifs = htonl(nifs); 569 reply.ia.nifs = htonl(nifs);
570 570
571 reply.ia.uuid[0] = afs_uuid.time_low; 571 reply.ia.uuid[0] = call->net->uuid.time_low;
572 reply.ia.uuid[1] = htonl(ntohs(afs_uuid.time_mid)); 572 reply.ia.uuid[1] = htonl(ntohs(call->net->uuid.time_mid));
573 reply.ia.uuid[2] = htonl(ntohs(afs_uuid.time_hi_and_version)); 573 reply.ia.uuid[2] = htonl(ntohs(call->net->uuid.time_hi_and_version));
574 reply.ia.uuid[3] = htonl((s8) afs_uuid.clock_seq_hi_and_reserved); 574 reply.ia.uuid[3] = htonl((s8) call->net->uuid.clock_seq_hi_and_reserved);
575 reply.ia.uuid[4] = htonl((s8) afs_uuid.clock_seq_low); 575 reply.ia.uuid[4] = htonl((s8) call->net->uuid.clock_seq_low);
576 for (loop = 0; loop < 6; loop++) 576 for (loop = 0; loop < 6; loop++)
577 reply.ia.uuid[loop + 5] = htonl((s8) afs_uuid.node[loop]); 577 reply.ia.uuid[loop + 5] = htonl((s8) call->net->uuid.node[loop]);
578 578
579 if (ifs) { 579 if (ifs) {
580 for (loop = 0; loop < nifs; loop++) { 580 for (loop = 0; loop < nifs; loop++) {