aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd/host.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2008-09-03 14:36:23 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2008-09-29 18:13:39 -0400
commite018040a824ab48211a1fcb86acebc9fc84759b0 (patch)
tree301728fcbd39cfe532b435eadb410ce048a21a3b /fs/lockd/host.c
parentbc48e4d6371137b1b06e985ea76c1254e9c06e83 (diff)
lockd: Update nsm_find() to support non-AF_INET addresses
Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/lockd/host.c')
-rw-r--r--fs/lockd/host.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index b9eeafe99a66..be8f19d53183 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -32,7 +32,8 @@ static int nrhosts;
32static DEFINE_MUTEX(nlm_host_mutex); 32static DEFINE_MUTEX(nlm_host_mutex);
33 33
34static void nlm_gc_hosts(void); 34static void nlm_gc_hosts(void);
35static struct nsm_handle *nsm_find(const struct sockaddr_in *sin, 35static struct nsm_handle *nsm_find(const struct sockaddr *sap,
36 const size_t salen,
36 const char *hostname, 37 const char *hostname,
37 const size_t hostname_len, 38 const size_t hostname_len,
38 const int create); 39 const int create);
@@ -185,7 +186,8 @@ static struct nlm_host *nlm_lookup_host(int server,
185 atomic_inc(&nsm->sm_count); 186 atomic_inc(&nsm->sm_count);
186 else { 187 else {
187 host = NULL; 188 host = NULL;
188 nsm = nsm_find(sin, hostname, hostname_len, 1); 189 nsm = nsm_find((struct sockaddr *)sin, sizeof(*sin),
190 hostname, hostname_len, 1);
189 if (!nsm) { 191 if (!nsm) {
190 dprintk("lockd: nlm_lookup_host failed; " 192 dprintk("lockd: nlm_lookup_host failed; "
191 "no nsm handle\n"); 193 "no nsm handle\n");
@@ -417,7 +419,8 @@ void nlm_host_rebooted(const struct sockaddr_in *sin,
417 struct nsm_handle *nsm; 419 struct nsm_handle *nsm;
418 struct nlm_host *host; 420 struct nlm_host *host;
419 421
420 nsm = nsm_find(sin, hostname, hostname_len, 0); 422 nsm = nsm_find((struct sockaddr *)sin, sizeof(*sin),
423 hostname, hostname_len, 0);
421 if (nsm == NULL) { 424 if (nsm == NULL) {
422 dprintk("lockd: never saw rebooted peer '%.*s' before\n", 425 dprintk("lockd: never saw rebooted peer '%.*s' before\n",
423 hostname_len, hostname); 426 hostname_len, hostname);
@@ -557,7 +560,8 @@ nlm_gc_hosts(void)
557static LIST_HEAD(nsm_handles); 560static LIST_HEAD(nsm_handles);
558static DEFINE_SPINLOCK(nsm_lock); 561static DEFINE_SPINLOCK(nsm_lock);
559 562
560static struct nsm_handle *nsm_find(const struct sockaddr_in *sin, 563static struct nsm_handle *nsm_find(const struct sockaddr *sap,
564 const size_t salen,
561 const char *hostname, 565 const char *hostname,
562 const size_t hostname_len, 566 const size_t hostname_len,
563 const int create) 567 const int create)
@@ -565,7 +569,7 @@ static struct nsm_handle *nsm_find(const struct sockaddr_in *sin,
565 struct nsm_handle *nsm = NULL; 569 struct nsm_handle *nsm = NULL;
566 struct nsm_handle *pos; 570 struct nsm_handle *pos;
567 571
568 if (!sin) 572 if (!sap)
569 return NULL; 573 return NULL;
570 574
571 if (hostname && memchr(hostname, '/', hostname_len) != NULL) { 575 if (hostname && memchr(hostname, '/', hostname_len) != NULL) {
@@ -585,7 +589,7 @@ retry:
585 if (strlen(pos->sm_name) != hostname_len 589 if (strlen(pos->sm_name) != hostname_len
586 || memcmp(pos->sm_name, hostname, hostname_len)) 590 || memcmp(pos->sm_name, hostname, hostname_len))
587 continue; 591 continue;
588 } else if (!nlm_cmp_addr(nsm_addr(pos), (struct sockaddr *)sin)) 592 } else if (!nlm_cmp_addr(nsm_addr(pos), sap))
589 continue; 593 continue;
590 atomic_inc(&pos->sm_count); 594 atomic_inc(&pos->sm_count);
591 kfree(nsm); 595 kfree(nsm);
@@ -605,8 +609,8 @@ retry:
605 if (nsm == NULL) 609 if (nsm == NULL)
606 return NULL; 610 return NULL;
607 611
608 memcpy(nsm_addr(nsm), sin, sizeof(*sin)); 612 memcpy(nsm_addr(nsm), sap, salen);
609 nsm->sm_addrlen = sizeof(*sin); 613 nsm->sm_addrlen = salen;
610 nsm->sm_name = (char *) (nsm + 1); 614 nsm->sm_name = (char *) (nsm + 1);
611 memcpy(nsm->sm_name, hostname, hostname_len); 615 memcpy(nsm->sm_name, hostname, hostname_len);
612 nsm->sm_name[hostname_len] = '\0'; 616 nsm->sm_name[hostname_len] = '\0';