Whamcloud - gitweb
1. When one thread enqueues and another thread matches, the matching
authorphil <phil>
Sun, 22 Feb 2004 04:19:29 +0000 (04:19 +0000)
committerphil <phil>
Sun, 22 Feb 2004 04:19:29 +0000 (04:19 +0000)
thread can get the lock before the enqueueing thread updates the lock
value block.  The correct fix is to do the granting inside of the
completion AST -- which can then be wrapped as appropriate to handle
the LVB mechanics -- but that's higher risk than I want right now.

Instead, I added a temporary LDLM_FL_CAN_MATCH flag, which gets set
only after the enqueueing thread is finished.  Threads trying to match
will wait for this flag to be set after the lock is granted.

2. Fixes a fencepost error in the KMS calculation; a lock on [x, y]
actually protects a file of y + 1 bytes, not y bytes.

3. I spotted that ldlm_completion_ast might not call wake_up in
certain cases, but I think that's a theoretical concern.  Fixed by
checking a different set of flags.

lustre/obdfilter/filter_lvb.c

index 17dc35d..254a3fb 100644 (file)
@@ -87,6 +87,11 @@ static int filter_lvbo_init(struct ldlm_resource *res)
  out:
         if (oa)
                 obdo_free(oa);
+        if (rc && lvb != NULL) {
+                OBD_FREE(lvb, sizeof(*lvb));
+                res->lr_lvb_data = NULL;
+                res->lr_lvb_len = 0;
+        }
         up(&res->lr_lvb_sem);
         return rc;
 }