Whamcloud - gitweb
* Chain granted locks off the export.
authorshaver <shaver>
Thu, 22 Aug 2002 13:30:11 +0000 (13:30 +0000)
committershaver <shaver>
Thu, 22 Aug 2002 13:30:11 +0000 (13:30 +0000)
lustre/include/linux/lustre_dlm.h
lustre/include/linux/obd_class.h
lustre/ldlm/ldlm_lock.c
lustre/ldlm/ldlm_lockd.c
lustre/mds/handler.c
lustre/obdclass/genops.c

index cd18fa2..d43c366 100644 (file)
@@ -8,9 +8,12 @@
 #ifdef __KERNEL__
 
 #include <linux/proc_fs.h>
-#include <linux/obd_class.h>
 #include <linux/lustre_net.h>
 
+struct obd_ops;
+struct obd_export;
+struct obd_device;
+
 #define OBD_LDLM_DEVICENAME  "ldlm"
 
 typedef enum {
@@ -193,6 +196,11 @@ struct ldlm_ast_work {
         void *w_data;
         int w_datalen;
 };
+
+/* Per-export ldlm state. */
+struct ldlm_export_data {
+        struct list_head led_held_locks;
+};
         
 static inline struct ldlm_extent *ldlm_res2extent(struct ldlm_resource *res)
 {
@@ -201,7 +209,6 @@ static inline struct ldlm_extent *ldlm_res2extent(struct ldlm_resource *res)
 
 extern struct obd_ops ldlm_obd_ops;
 
-
 extern char *ldlm_lockname[];
 extern char *ldlm_typename[];
 extern char *ldlm_it2str(int it);
index 66b7713..793b1a6 100644 (file)
@@ -40,6 +40,7 @@
 #include <linux/lustre_lib.h>
 #include <linux/lustre_idl.h>
 #include <linux/lustre_mds.h>
+#include <linux/lustre_dlm.h>
 #endif
 
 
@@ -76,8 +77,8 @@ struct obd_export {
         struct obd_device        *exp_obd;
         struct ptlrpc_connection *exp_connection;
         struct mds_export_data    exp_mds_data;
-#if NOTYET && 0
         struct ldlm_export_data   exp_ldlm_data;
+#if NOTYET && 0
         struct ost_export_data    exp_ost_data;
 #endif
         void                     *exp_data; /* device specific data */
index c2f9f25..d1edbdb 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/random.h>
 #include <linux/lustre_dlm.h>
 #include <linux/lustre_mds.h>
+#include <linux/obd_class.h>
 
 /* lock types */
 char *ldlm_lockname[] = {
@@ -189,7 +190,10 @@ void ldlm_lock_destroy(struct ldlm_lock *lock)
                 return;
         }
 
+        list_del(&lock->l_export_chain);
+        lock->l_export = NULL;
         lock->l_flags = LDLM_FL_DESTROYED;
+
         l_unlock(&lock->l_resource->lr_namespace->ns_lock);
         LDLM_LOCK_PUT(lock);
         EXIT;
@@ -317,9 +321,6 @@ struct ldlm_lock *ldlm_handle2lock(struct lustre_handle *handle)
         return retval;
 }
 
-
-
-
 static int ldlm_plain_compat(struct ldlm_lock *a, struct ldlm_lock *b)
 {
         return lockmode_compat(a->l_req_mode, b->l_req_mode);
index 4d687a3..374f777 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/slab.h>
 #include <linux/lustre_dlm.h>
 #include <linux/init.h>
+#include <linux/obd_class.h>
 
 extern kmem_cache_t *ldlm_resource_slab;
 extern kmem_cache_t *ldlm_lock_slab;
@@ -74,7 +75,7 @@ int ldlm_add_waiting_lock(struct ldlm_lock *lock)
                        waiting_locks_timer.expires);
                 mod_timer(&waiting_locks_timer, timeout_rounded);
         }
-        list_add(&lock->l_pending_chain, waiting_locks_list.prev); /* FIFO */
+        list_add_tail(&lock->l_pending_chain, &waiting_locks_list); /* FIFO */
         spin_unlock_bh(&waiting_locks_spinlock);
         RETURN(1);
 }
@@ -254,6 +255,13 @@ int ldlm_handle_enqueue(struct ptlrpc_request *req)
         }
 
         lock->l_export = req->rq_export;
+        if (lock->l_export) {
+                l_lock(&lock->l_resource->lr_namespace->ns_lock);
+                list_add(&lock->l_export_chain,
+                         &lock->l_export->exp_ldlm_data.led_held_locks);
+                l_unlock(&lock->l_resource->lr_namespace->ns_lock);
+        }
+
         ptlrpc_connection_addref(req->rq_connection);
         EXIT;
  out:
index 11b3dda..b179fa9 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/lustre_mds.h>
 #include <linux/lustre_dlm.h>
 #include <linux/init.h>
+#include <linux/obd_class.h>
 
 extern int mds_get_lovtgts(struct obd_device *obd, int tgt_count,
                            uuid_t *uuidarray);
index 3061d13..359fcfa 100644 (file)
@@ -274,7 +274,9 @@ struct obd_export *class_new_export(struct obd_device *obddev)
         memset(export, 0, sizeof(*export));
         get_random_bytes(&export->exp_cookie, sizeof(__u64));
         export->exp_obd = obddev;
+        /* XXX should these be in MDS and LDLM init functions? */
         INIT_LIST_HEAD(&export->exp_mds_data.med_open_head);
+        INIT_LIST_HEAD(&export->exp_ldlm_data.led_held_locks);
         list_add(&(export->exp_chain), &export->exp_obd->obd_exports);
         return export;
 }