Whamcloud - gitweb
LU-12616 obclass: fix MDS start/stop race
[fs/lustre-release.git] / lustre / obdclass / lustre_handles.c
index fabd20b..f790f7d 100644 (file)
@@ -36,6 +36,8 @@
 
 #define DEBUG_SUBSYSTEM S_CLASS
 
+#include <linux/random.h>
+
 #include <obd_support.h>
 #include <lustre_handles.h>
 #include <lustre_lib.h>
@@ -58,7 +60,7 @@ static struct handle_bucket {
  * global (per-node) hash-table.
  */
 void class_handle_hash(struct portals_handle *h,
-                      struct portals_handle_ops *ops)
+                      const struct portals_handle_ops *ops)
 {
        struct handle_bucket *bucket;
 
@@ -133,23 +135,7 @@ void class_handle_unhash(struct portals_handle *h)
 }
 EXPORT_SYMBOL(class_handle_unhash);
 
-void class_handle_hash_back(struct portals_handle *h)
-{
-       struct handle_bucket *bucket;
-       ENTRY;
-
-       bucket = handle_hash + (h->h_cookie & HANDLE_HASH_MASK);
-
-       spin_lock(&bucket->lock);
-       list_add_rcu(&h->h_link, &bucket->head);
-       h->h_in = 1;
-       spin_unlock(&bucket->lock);
-
-       EXIT;
-}
-EXPORT_SYMBOL(class_handle_hash_back);
-
-void *class_handle2object(__u64 cookie, const void *owner)
+void *class_handle2object(u64 cookie, const struct portals_handle_ops *ops)
 {
        struct handle_bucket *bucket;
        struct portals_handle *h;
@@ -167,7 +153,7 @@ void *class_handle2object(__u64 cookie, const void *owner)
 
        rcu_read_lock();
        list_for_each_entry_rcu(h, &bucket->head, h_link) {
-               if (h->h_cookie != cookie || h->h_owner != owner)
+               if (h->h_cookie != cookie || h->h_ops != ops)
                        continue;
 
                spin_lock(&h->h_lock);
@@ -215,7 +201,7 @@ int class_handle_init(void)
                spin_lock_init(&bucket->lock);
        }
 
-       cfs_get_random_bytes(&handle_base, sizeof(handle_base));
+       get_random_bytes(&handle_base, sizeof(handle_base));
        LASSERT(handle_base != 0ULL);
 
        return 0;