Whamcloud - gitweb
*** empty log message ***
authorpschwan <pschwan>
Mon, 24 Jun 2002 06:20:03 +0000 (06:20 +0000)
committerpschwan <pschwan>
Mon, 24 Jun 2002 06:20:03 +0000 (06:20 +0000)
lustre/include/linux/lustre_dlm.h
lustre/ldlm/ldlm_lock.c
lustre/ldlm/ldlm_lockd.c
lustre/ldlm/ldlm_request.c
lustre/ldlm/ldlm_test.c
lustre/mds/handler.c
lustre/mds/mds_reint.c
lustre/osc/osc_request.c

index af9a2f6..5ca4e90 100644 (file)
@@ -264,7 +264,7 @@ int ldlm_cli_enqueue(struct ptlrpc_client *cl,
                      void *data,
                      __u32 data_len,
                      struct lustre_handle *lockh);
-int ldlm_cli_callback(struct ldlm_lock *lock, struct ldlm_lock_desc *new,
+int ldlm_cli_callback(struct lustre_handle *lockh, struct ldlm_lock_desc *new,
                       void *data, __u32 data_len, struct ptlrpc_request **reqp);
 int ldlm_cli_convert(struct ptlrpc_client *, struct lustre_handle *,
                      int new_mode, int *flags);
index 8490a47..0c8dbab 100644 (file)
@@ -511,7 +511,7 @@ void ldlm_grant_lock(struct ldlm_lock *lock)
                 res->lr_most_restr = lock->l_granted_mode;
 
         if (lock->l_completion_ast) {
-                struct lustre_handle *lockh;
+                struct lustre_handle lockh;
 
                 /* FIXME: this should merely add lock to lr_tmp list */
                 ldlm_lock2handle(lock, &lockh);
index 28be178..f791d9d 100644 (file)
@@ -218,12 +218,16 @@ static int ldlm_handle_callback(struct ptlrpc_service *svc,
                 do_ast = (!lock->l_readers && !lock->l_writers); 
                 l_unlock(&lock->l_resource->lr_namespace->ns_lock);
                 
-                if (do_ast) { 
+                if (do_ast) {
                         CDEBUG(D_INFO, "Lock already unused, calling "
                                "callback (%p).\n", lock->l_blocking_ast);
-                        if (lock->l_blocking_ast != NULL)
-                                lock->l_blocking_ast(lock, descp, lock->l_data,
+                        if (lock->l_blocking_ast != NULL) {
+                                struct lustre_handle lockh;
+                                ldlm_lock2handle(lock, &lockh);
+                                lock->l_blocking_ast(&lockh, descp,
+                                                     lock->l_data,
                                                      lock->l_data_len, NULL);
+                        }
                 } else {
                         LDLM_DEBUG(lock, "Lock still has references, will be"
                                " cancelled later");
index e6d77c0..a45836f 100644 (file)
@@ -142,6 +142,7 @@ int ldlm_cli_enqueue(struct ptlrpc_client *cl, struct ptlrpc_connection *conn,
 int ldlm_cli_callback(struct lustre_handle *lockh, struct ldlm_lock_desc *desc,
                       void *data, __u32 data_len, struct ptlrpc_request **reqp)
 {
+        struct ldlm_lock *lock;
         struct ldlm_request *body;
         struct ptlrpc_request *req;
         struct ptlrpc_client *cl =
@@ -149,6 +150,10 @@ int ldlm_cli_callback(struct lustre_handle *lockh, struct ldlm_lock_desc *desc,
         int rc = 0, size = sizeof(*body);
         ENTRY;
 
+        lock = ldlm_handle2lock(lockh);
+        if (lock == NULL)
+                LBUG();
+
         req = ptlrpc_prep_req(cl, lock->l_connection, LDLM_CALLBACK, 1,
                               &size, NULL);
         if (!req)
@@ -179,8 +184,10 @@ int ldlm_cli_callback(struct lustre_handle *lockh, struct ldlm_lock_desc *desc,
         } else
                 *reqp = req;
 
+
         EXIT;
  out:
+        ldlm_lock_put(lock);
         return rc;
 }
 
index 16b10f9..d89f6df 100644 (file)
@@ -24,12 +24,12 @@ static spinlock_t ctl_lock = SPIN_LOCK_UNLOCKED;
 static struct list_head ctl_threads;
 static int regression_running = 0;
 
-static int ldlm_test_callback(struct ldlm_lock *lock,
+static int ldlm_test_callback(struct lustre_handle *lockh,
                               struct ldlm_lock_desc *new,
                               void *data, __u32 data_len,
                               struct ptlrpc_request **reqp)
 {
-        printk("ldlm_test_callback: lock=%p, new=%p\n", lock, new);
+        printk("ldlm_test_callback: lock=%Lu, new=%p\n", lockh->addr, new);
         return 0;
 }
 
index abb73a3..39fc411 100644 (file)
@@ -257,7 +257,7 @@ static int mds_disconnect(struct mds_obd *mds, struct ptlrpc_request *req)
         RETURN(0);
 }
 
-int mds_lock_callback(struct ldlm_lock *lock, struct ldlm_lock *new,
+int mds_lock_callback(struct lustre_handle *lockh, struct ldlm_lock *new,
                       void *data, int data_len, struct ptlrpc_request **reqp)
 {
         ENTRY;
@@ -267,7 +267,7 @@ int mds_lock_callback(struct ldlm_lock *lock, struct ldlm_lock *new,
                 RETURN(0);
         }
 
-        if (ldlm_cli_cancel(lock->l_client, lock) < 0)
+        if (ldlm_cancel(lockh) < 0)
                 LBUG();
         RETURN(0);
 }
@@ -314,8 +314,8 @@ static int mds_getattr_name(int offset, struct ptlrpc_request *req)
         lock_mode = (req->rq_reqmsg->opc == MDS_REINT) ? LCK_CW : LCK_PW;
         res_id[0] = dir->i_ino;
 
-        rc = ldlm_local_lock_match(mds->mds_local_namespace, res_id, LDLM_PLAIN,
-                                   NULL, 0, lock_mode, &lockh);
+        rc = ldlm_lock_match(mds->mds_local_namespace, res_id, LDLM_PLAIN,
+                             NULL, 0, lock_mode, &lockh);
         if (rc == 0) {
                 LDLM_DEBUG_NOLOCK("enqueue res %Lu", res_id[0]);
                 rc = ldlm_cli_enqueue(mds->mds_ldlm_client, mds->mds_ldlm_conn,
index fc4b9e0..2c066f2 100644 (file)
@@ -215,8 +215,8 @@ static int mds_reint_create(struct mds_update_record *rec, int offset,
         lock_mode = (req->rq_reqmsg->opc == MDS_REINT) ? LCK_CW : LCK_PW;
         res_id[0] = dir->i_ino;
 
-        rc = ldlm_local_lock_match(mds->mds_local_namespace, res_id, LDLM_PLAIN,
-                                   NULL, 0, lock_mode, &lockh);
+        rc = ldlm_lock_match(mds->mds_local_namespace, res_id, LDLM_PLAIN,
+                             NULL, 0, lock_mode, &lockh);
         if (rc == 0) {
                 LDLM_DEBUG_NOLOCK("enqueue res %Lu", res_id[0]);
                 rc = ldlm_cli_enqueue(mds->mds_ldlm_client, mds->mds_ldlm_conn,
@@ -539,7 +539,7 @@ out_unlink_de:
         if (!rc) { 
                 lock = lustre_handle2object(&lockh);
                 ldlm_lock_decref(lock, LCK_EX);
-                rc = ldlm_cli_cancel(lock->l_client, lock);
+                rc = ldlm_cancel(lockh);
                 if (rc < 0)
                         CERROR("failed to cancel child inode lock ino "
                                "%Ld: %d\n", res_id[0], rc);
index 93229b3..822dc3f 100644 (file)
@@ -664,8 +664,8 @@ static int osc_enqueue(struct obd_conn *oconn,
 
         /* Next, search for already existing extent locks that will cover us */
         osc_con2dlmcl(oconn, &cl, &conn);
-        rc = ldlm_local_lock_match(obddev->obd_namespace, res_id, type, extent,
-                                   sizeof(extent), mode, lockh);
+        rc = ldlm_lock_match(obddev->obd_namespace, res_id, type, extent,
+                             sizeof(extent), mode, lockh);
         if (rc == 1) {
                 /* We already have a lock, and it's referenced */
                 return 0;