Whamcloud - gitweb
LU-274 Update LVB from disk when glimpse callback return error
authorNiu Yawei <niu@whamcloud.com>
Fri, 20 May 2011 10:12:50 +0000 (03:12 -0700)
committerOleg Drokin <green@whamcloud.com>
Wed, 25 May 2011 16:52:09 +0000 (09:52 -0700)
There are various cases that glimpse callback return errors,
we should update the LVB from disk whenever the glimpse ast failed.

Signed-off-by: Niu Yawei <niu@whamcloud.com>
Change-Id: I120ebcb6254cee5b797c09545d29cc7dcc12a5d2
Reviewed-on: http://review.whamcloud.com/583
Tested-by: Hudson
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
lustre/ldlm/ldlm_lockd.c

index 101a848..6234ccf 100644 (file)
@@ -966,12 +966,20 @@ int ldlm_server_glimpse_ast(struct ldlm_lock *lock, void *data)
                                      LDLM_GL_CALLBACK - LDLM_FIRST_OPC);
 
         rc = ptlrpc_queue_wait(req);
-        if (rc == -ELDLM_NO_LOCK_DATA)
+        /* Update the LVB from disk if the AST failed (this is a legal race)
+         *
+         * - Glimpse callback of local lock just return -ELDLM_NO_LOCK_DATA.
+         * - Glimpse callback of remote lock might return -ELDLM_NO_LOCK_DATA
+         *   when inode is cleared. LU-274
+         */
+        if (rc == -ELDLM_NO_LOCK_DATA) {
                 LDLM_DEBUG(lock, "lost race - client has a lock but no inode");
-        else if (rc != 0)
+                ldlm_res_lvbo_update(res, NULL, 1);
+        } else if (rc != 0) {
                 rc = ldlm_handle_ast_error(lock, req, rc, "glimpse");
-        else
+        } else {
                 rc = ldlm_res_lvbo_update(res, req, 1);
+        }
 
         ptlrpc_req_finished(req);
         if (rc == -ERESTART)