r=zam,shadow
- kill old locks from ldlm pools in convert time before adding them back with new mode.
*/
void ldlm_lock_downgrade(struct ldlm_lock *lock, int new_mode)
{
*/
void ldlm_lock_downgrade(struct ldlm_lock *lock, int new_mode)
{
+ struct ldlm_namespace *ns;
ENTRY;
LASSERT(lock->l_granted_mode & (LCK_PW | LCK_EX));
ENTRY;
LASSERT(lock->l_granted_mode & (LCK_PW | LCK_EX));
lock_res_and_lock(lock);
ldlm_resource_unlink_lock(lock);
lock_res_and_lock(lock);
ldlm_resource_unlink_lock(lock);
+ /*
+ * Remove the lock from pool as it will be added again in
+ * ldlm_grant_lock() called below.
+ */
+ ns = lock->l_resource->lr_namespace;
+ ldlm_pool_del(&ns->ns_pool, lock);
+
lock->l_req_mode = new_mode;
ldlm_grant_lock(lock, NULL);
unlock_res_and_lock(lock);
lock->l_req_mode = new_mode;
ldlm_grant_lock(lock, NULL);
unlock_res_and_lock(lock);
+
+ /*
+ * Remove old lock from the pool before adding the lock with new
+ * mode below in ->policy()
+ */
+ ldlm_pool_del(&ns->ns_pool, lock);
/* If this is a local resource, put it on the appropriate list. */
if (ns_is_client(res->lr_namespace)) {
/* If this is a local resource, put it on the appropriate list. */
if (ns_is_client(res->lr_namespace)) {
+ LDLM_DEBUG(lock, "add lock to pool");
atomic_inc(&pl->pl_granted);
atomic_inc(&pl->pl_grant_rate);
atomic_inc(&pl->pl_grant_speed);
atomic_inc(&pl->pl_granted);
atomic_inc(&pl->pl_grant_rate);
atomic_inc(&pl->pl_grant_speed);
+ LDLM_DEBUG(lock, "del lock from pool");
LASSERT(atomic_read(&pl->pl_granted) > 0);
atomic_dec(&pl->pl_granted);
atomic_inc(&pl->pl_cancel_rate);
LASSERT(atomic_read(&pl->pl_granted) > 0);
atomic_dec(&pl->pl_granted);
atomic_inc(&pl->pl_cancel_rate);