x86, perf: P4 PMU -- configure predefined events
[safe/jmp/linux-2.6] / fs / lockd / host.c
index ed10338..bb464d1 100644 (file)
@@ -15,7 +15,6 @@
 #include <linux/sunrpc/clnt.h>
 #include <linux/sunrpc/svc.h>
 #include <linux/lockd/lockd.h>
-#include <linux/lockd/sm_inter.h>
 #include <linux/mutex.h>
 
 #include <net/ipv6.h>
@@ -88,18 +87,6 @@ static unsigned int nlm_hash_address(const struct sockaddr *sap)
        return hash & (NLM_HOST_NRHASH - 1);
 }
 
-static void nlm_clear_port(struct sockaddr *sap)
-{
-       switch (sap->sa_family) {
-       case AF_INET:
-               ((struct sockaddr_in *)sap)->sin_port = 0;
-               break;
-       case AF_INET6:
-               ((struct sockaddr_in6 *)sap)->sin6_port = 0;
-               break;
-       }
-}
-
 /*
  * Common host lookup routine for server & client
  */
@@ -124,7 +111,7 @@ static struct nlm_host *nlm_lookup_host(struct nlm_lookup_host_info *ni)
         */
        chain = &nlm_hosts[nlm_hash_address(ni->sap)];
        hlist_for_each_entry(host, pos, chain, h_hash) {
-               if (!nlm_cmp_addr(nlm_addr(host), ni->sap))
+               if (!rpc_cmp_addr(nlm_addr(host), ni->sap))
                        continue;
 
                /* See if we have an NSM handle for this client */
@@ -138,7 +125,7 @@ static struct nlm_host *nlm_lookup_host(struct nlm_lookup_host_info *ni)
                if (host->h_server != ni->server)
                        continue;
                if (ni->server &&
-                   !nlm_cmp_addr(nlm_srcaddr(host), ni->src_sap))
+                   !rpc_cmp_addr(nlm_srcaddr(host), ni->src_sap))
                        continue;
 
                /* Move to head of hash chain. */
@@ -159,8 +146,8 @@ static struct nlm_host *nlm_lookup_host(struct nlm_lookup_host_info *ni)
                atomic_inc(&nsm->sm_count);
        else {
                host = NULL;
-               nsm = nsm_find(ni->sap, ni->salen,
-                               ni->hostname, ni->hostname_len, 1);
+               nsm = nsm_get_handle(ni->sap, ni->salen,
+                                       ni->hostname, ni->hostname_len);
                if (!nsm) {
                        dprintk("lockd: nlm_lookup_host failed; "
                                "no nsm handle\n");
@@ -178,7 +165,7 @@ static struct nlm_host *nlm_lookup_host(struct nlm_lookup_host_info *ni)
        host->h_addrbuf    = nsm->sm_addrbuf;
        memcpy(nlm_addr(host), ni->sap, ni->salen);
        host->h_addrlen = ni->salen;
-       nlm_clear_port(nlm_addr(host));
+       rpc_set_port(nlm_addr(host), 0);
        memcpy(nlm_srcaddr(host), ni->src_sap, ni->src_len);
        host->h_version    = ni->version;
        host->h_proto      = ni->protocol;
@@ -453,29 +440,14 @@ void nlm_release_host(struct nlm_host *host)
  */
 void nlm_host_rebooted(const struct nlm_reboot *info)
 {
-       const struct sockaddr_in sin = {
-               .sin_family             = AF_INET,
-               .sin_addr.s_addr        = info->addr,
-       };
        struct hlist_head *chain;
        struct hlist_node *pos;
        struct nsm_handle *nsm;
        struct nlm_host *host;
 
-       nsm = nsm_find((struct sockaddr *)&sin, sizeof(sin),
-                       info->mon, info->len, 0);
-       if (nsm == NULL) {
-               dprintk("lockd: never saw rebooted peer '%.*s' before\n",
-                               info->len, info->mon);
+       nsm = nsm_reboot_lookup(info);
+       if (unlikely(nsm == NULL))
                return;
-       }
-
-       dprintk("lockd: nlm_host_rebooted(%.*s, %s)\n",
-                       info->len, info->mon, nsm->sm_addrbuf);
-
-       /* When reclaiming locks on this peer, make sure that
-        * we set up a new notification */
-       nsm->sm_monitored = 0;
 
        /* Mark all hosts tied to this NSM state as having rebooted.
         * We run the loop repeatedly, because we drop the host table
@@ -507,8 +479,8 @@ again:      mutex_lock(&nlm_host_mutex);
                        }
                }
        }
-
        mutex_unlock(&nlm_host_mutex);
+       nsm_release(nsm);
 }
 
 /*