aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2008-12-05 19:03:31 -0500
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-01-06 11:53:54 -0500
commit7fefc9cb9d5f129c238d93166f705c96ca2e7e51 (patch)
tree3309560f4539ea8af3943524475cd9405f3c9c49 /fs
parentcab2d3c99165abbba2943f1b269003b17fd3b1cb (diff)
NLM: Change nlm_host_rebooted() to take a single nlm_reboot argument
Pass the nlm_reboot data structure directly from the NLMPROC_SM_NOTIFY XDR decoders to nlm_host_rebooted(). This eliminates some packing and unpacking of the NLMPROC_SM_NOTIFY results, and prepares for passing these results, including the "priv" cookie, directly to a lookup routine in fs/lockd/mon.c. This patch changes code organization but should not cause any behavioral change. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs')
-rw-r--r--fs/lockd/host.c31
-rw-r--r--fs/lockd/svc4proc.c11
-rw-r--r--fs/lockd/svcproc.c11
3 files changed, 19 insertions, 34 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index dbdeaa88d2fa..ed103387964d 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -444,31 +444,34 @@ void nlm_release_host(struct nlm_host *host)
444 } 444 }
445} 445}
446 446
447/* 447/**
448 * We were notified that the host indicated by address &sin 448 * nlm_host_rebooted - Release all resources held by rebooted host
449 * has rebooted. 449 * @info: pointer to decoded results of NLM_SM_NOTIFY call
450 * Release all resources held by that peer. 450 *
451 * We were notified that the specified host has rebooted. Release
452 * all resources held by that peer.
451 */ 453 */
452void nlm_host_rebooted(const struct sockaddr_in *sin, 454void nlm_host_rebooted(const struct nlm_reboot *info)
453 const char *hostname,
454 unsigned int hostname_len,
455 u32 new_state)
456{ 455{
456 const struct sockaddr_in sin = {
457 .sin_family = AF_INET,
458 .sin_addr.s_addr = info->addr,
459 };
457 struct hlist_head *chain; 460 struct hlist_head *chain;
458 struct hlist_node *pos; 461 struct hlist_node *pos;
459 struct nsm_handle *nsm; 462 struct nsm_handle *nsm;
460 struct nlm_host *host; 463 struct nlm_host *host;
461 464
462 nsm = nsm_find((struct sockaddr *)sin, sizeof(*sin), 465 nsm = nsm_find((struct sockaddr *)&sin, sizeof(sin),
463 hostname, hostname_len, 0); 466 info->mon, info->len, 0);
464 if (nsm == NULL) { 467 if (nsm == NULL) {
465 dprintk("lockd: never saw rebooted peer '%.*s' before\n", 468 dprintk("lockd: never saw rebooted peer '%.*s' before\n",
466 hostname_len, hostname); 469 info->len, info->mon);
467 return; 470 return;
468 } 471 }
469 472
470 dprintk("lockd: nlm_host_rebooted(%.*s, %s)\n", 473 dprintk("lockd: nlm_host_rebooted(%.*s, %s)\n",
471 hostname_len, hostname, nsm->sm_addrbuf); 474 info->len, info->mon, nsm->sm_addrbuf);
472 475
473 /* When reclaiming locks on this peer, make sure that 476 /* When reclaiming locks on this peer, make sure that
474 * we set up a new notification */ 477 * we set up a new notification */
@@ -483,8 +486,8 @@ again: mutex_lock(&nlm_host_mutex);
483 for (chain = nlm_hosts; chain < nlm_hosts + NLM_HOST_NRHASH; ++chain) { 486 for (chain = nlm_hosts; chain < nlm_hosts + NLM_HOST_NRHASH; ++chain) {
484 hlist_for_each_entry(host, pos, chain, h_hash) { 487 hlist_for_each_entry(host, pos, chain, h_hash) {
485 if (host->h_nsmhandle == nsm 488 if (host->h_nsmhandle == nsm
486 && host->h_nsmstate != new_state) { 489 && host->h_nsmstate != info->state) {
487 host->h_nsmstate = new_state; 490 host->h_nsmstate = info->state;
488 host->h_state++; 491 host->h_state++;
489 492
490 nlm_get_host(host); 493 nlm_get_host(host);
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
index 4dfdcbc6bf68..bb79a53e0608 100644
--- a/fs/lockd/svc4proc.c
+++ b/fs/lockd/svc4proc.c
@@ -419,8 +419,6 @@ static __be32
419nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, 419nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
420 void *resp) 420 void *resp)
421{ 421{
422 struct sockaddr_in saddr;
423
424 dprintk("lockd: SM_NOTIFY called\n"); 422 dprintk("lockd: SM_NOTIFY called\n");
425 423
426 if (!nlm_privileged_requester(rqstp)) { 424 if (!nlm_privileged_requester(rqstp)) {
@@ -430,14 +428,7 @@ nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
430 return rpc_system_err; 428 return rpc_system_err;
431 } 429 }
432 430
433 /* Obtain the host pointer for this NFS server and try to 431 nlm_host_rebooted(argp);
434 * reclaim all locks we hold on this server.
435 */
436 memset(&saddr, 0, sizeof(saddr));
437 saddr.sin_family = AF_INET;
438 saddr.sin_addr.s_addr = argp->addr;
439 nlm_host_rebooted(&saddr, argp->mon, argp->len, argp->state);
440
441 return rpc_success; 432 return rpc_success;
442} 433}
443 434
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index 3ca89e2a9381..e44310c0211c 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -451,8 +451,6 @@ static __be32
451nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, 451nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
452 void *resp) 452 void *resp)
453{ 453{
454 struct sockaddr_in saddr;
455
456 dprintk("lockd: SM_NOTIFY called\n"); 454 dprintk("lockd: SM_NOTIFY called\n");
457 455
458 if (!nlm_privileged_requester(rqstp)) { 456 if (!nlm_privileged_requester(rqstp)) {
@@ -462,14 +460,7 @@ nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
462 return rpc_system_err; 460 return rpc_system_err;
463 } 461 }
464 462
465 /* Obtain the host pointer for this NFS server and try to 463 nlm_host_rebooted(argp);
466 * reclaim all locks we hold on this server.
467 */
468 memset(&saddr, 0, sizeof(saddr));
469 saddr.sin_family = AF_INET;
470 saddr.sin_addr.s_addr = argp->addr;
471 nlm_host_rebooted(&saddr, argp->mon, argp->len, argp->state);
472
473 return rpc_success; 464 return rpc_success;
474} 465}
475 466