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 */
* 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;