Whamcloud - gitweb
- fixes from 1_5 (from green and bzzz).
authoryury <yury>
Tue, 10 Oct 2006 14:19:32 +0000 (14:19 +0000)
committeryury <yury>
Tue, 10 Oct 2006 14:19:32 +0000 (14:19 +0000)
lustre/ldlm/ldlm_lockd.c
lustre/llite/file.c

index 0f63667..701bb67 100644 (file)
@@ -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 */
index fdcfa1d..bfb45c4 100644 (file)
@@ -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;