From 755755ad55af076ddaee3b0b0a421465dcd36776 Mon Sep 17 00:00:00 2001 From: yury Date: Tue, 10 Oct 2006 14:19:32 +0000 Subject: [PATCH] - fixes from 1_5 (from green and bzzz). --- lustre/ldlm/ldlm_lockd.c | 21 +++++++++++++++------ lustre/llite/file.c | 4 +++- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 0f63667..701bb67 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -886,12 +886,21 @@ existing_lock: rc = -ENOTCONN; } else if (lock->l_flags & LDLM_FL_AST_SENT) { dlm_rep->lock_flags |= LDLM_FL_AST_SENT; - if (dlm_rep->lock_flags & LDLM_FL_CANCEL_ON_BLOCK) { - unlock_res_and_lock(lock); - ldlm_lock_cancel(lock); - lock_res_and_lock(lock); - } else if (lock->l_granted_mode == lock->l_req_mode) - ldlm_add_waiting_lock(lock); + if (lock->l_granted_mode == lock->l_req_mode) { + /* + * Only cancel lock if it was granted, because it would + * be destroyed immediatelly and would never be granted + * in the future, causing timeouts on client. Not + * granted lock will be cancelled immediatelly after + * sending completion AST. + */ + if (dlm_rep->lock_flags & LDLM_FL_CANCEL_ON_BLOCK) { + unlock_res_and_lock(lock); + ldlm_lock_cancel(lock); + lock_res_and_lock(lock); + } else if (lock->l_granted_mode == lock->l_req_mode) + ldlm_add_waiting_lock(lock); + } } /* Make sure we never ever grant usual metadata locks to liblustre clients */ diff --git a/lustre/llite/file.c b/lustre/llite/file.c index fdcfa1d..bfb45c4 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -1368,8 +1368,10 @@ repeat: * short read (B) or some zeroes at the end of the buffer (C) */ ll_inode_size_unlock(inode, 1); retval = ll_glimpse_size(inode, LDLM_FL_BLOCK_GRANTED); - if (retval) + if (retval) { + ll_tree_unlock(&tree); goto out; + } } else { /* region is within kms and, hence, within real file size (A) */ inode->i_size = kms; -- 1.8.3.1