From 63fb505732f39170e326b662899260c1f9d7a3b3 Mon Sep 17 00:00:00 2001 From: phil Date: Sun, 22 Feb 2004 04:19:28 +0000 Subject: [PATCH] 1. When one thread enqueues and another thread matches, the matching 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/mdc/mdc_locks.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index a2830b8..f102439 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -320,6 +320,7 @@ int mdc_enqueue(struct obd_export *exp, lock_mode = lock->l_req_mode; } + ldlm_lock_allow_match(lock); LDLM_LOCK_PUT(lock); } -- 1.8.3.1