FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

NLM: Change nlm_host_rebooted() to take a single nlm_reboot argument · fabgithub/linux@7fefc9c · GitHub

Repository navigation

Commit 7fefc9c

Browse files
authored andcommitted
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>
1 parent cab2d3c commit 7fefc9c

4 files changed

Lines changed: 20 additions & 36 deletions

File tree

‎fs/lockd/host.c‎

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -444,31 +444,34 @@ void nlm_release_host(struct nlm_host *host)
444444
}
445445
}
446446

447-
/*
448-
* We were notified that the host indicated by address &sin
449-
* has rebooted.
450-
* Release all resources held by that peer.
447+
/**
448+
* nlm_host_rebooted - Release all resources held by rebooted host
449+
* @info: pointer to decoded results of NLM_SM_NOTIFY call
450+
*
451+
* We were notified that the specified host has rebooted. Release
452+
* all resources held by that peer.
451453
*/
452-
void nlm_host_rebooted(const struct sockaddr_in *sin,
453-
const char *hostname,
454-
unsigned int hostname_len,
455-
u32 new_state)
454+
void nlm_host_rebooted(const struct nlm_reboot *info)
456455
{
456+
const struct sockaddr_in sin = {
457+
.sin_family = AF_INET,
458+
.sin_addr.s_addr = info->addr,
459+
};
457460
struct hlist_head *chain;
458461
struct hlist_node *pos;
459462
struct nsm_handle *nsm;
460463
struct nlm_host *host;
461464

462-
nsm = nsm_find((struct sockaddr *)sin, sizeof(*sin),
463-
hostname, hostname_len, 0);
465+
nsm = nsm_find((struct sockaddr *)&sin, sizeof(sin),
466+
info->mon, info->len, 0);
464467
if (nsm == NULL) {
465468
dprintk("lockd: never saw rebooted peer '%.*s' before\n",
466-
hostname_len, hostname);
469+
info->len, info->mon);
467470
return;
468471
}
469472

470473
dprintk("lockd: nlm_host_rebooted(%.*s, %s)\n",
471-
hostname_len, hostname, nsm->sm_addrbuf);
474+
info->len, info->mon, nsm->sm_addrbuf);
472475

473476
/* When reclaiming locks on this peer, make sure that
474477
* we set up a new notification */
@@ -483,8 +486,8 @@ again: mutex_lock(&nlm_host_mutex);
483486
for (chain = nlm_hosts; chain < nlm_hosts + NLM_HOST_NRHASH; ++chain) {
484487
hlist_for_each_entry(host, pos, chain, h_hash) {
485488
if (host->h_nsmhandle == nsm
486-
&& host->h_nsmstate != new_state) {
487-
host->h_nsmstate = new_state;
489+
&& host->h_nsmstate != info->state) {
490+
host->h_nsmstate = info->state;
488491
host->h_state++;
489492

490493
nlm_get_host(host);

‎fs/lockd/svc4proc.c‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,6 @@ static __be32
419419
nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
420420
void *resp)
421421
{
422-
struct sockaddr_in saddr;
423-
424422
dprintk("lockd: SM_NOTIFY called\n");
425423

426424
if (!nlm_privileged_requester(rqstp)) {
@@ -430,14 +428,7 @@ nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
430428
return rpc_system_err;
431429
}
432430

433-
/* Obtain the host pointer for this NFS server and try to
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-
431+
nlm_host_rebooted(argp);
441432
return rpc_success;
442433
}
443434

‎fs/lockd/svcproc.c‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,6 @@ static __be32
451451
nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
452452
void *resp)
453453
{
454-
struct sockaddr_in saddr;
455-
456454
dprintk("lockd: SM_NOTIFY called\n");
457455

458456
if (!nlm_privileged_requester(rqstp)) {
@@ -462,14 +460,7 @@ nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
462460
return rpc_system_err;
463461
}
464462

465-
/* Obtain the host pointer for this NFS server and try to
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-
463+
nlm_host_rebooted(argp);
473464
return rpc_success;
474465
}
475466

‎include/linux/lockd/lockd.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,7 @@ void nlm_rebind_host(struct nlm_host *);
239239
struct nlm_host * nlm_get_host(struct nlm_host *);
240240
void nlm_release_host(struct nlm_host *);
241241
void nlm_shutdown_hosts(void);
242-
extern void nlm_host_rebooted(const struct sockaddr_in *, const char *,
243-
unsigned int, u32);
242+
void nlm_host_rebooted(const struct nlm_reboot *);
244243

245244
/*
246245
* Host monitoring

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL