Whamcloud - gitweb
Fixed recovd deadlock
authorpschwan <pschwan>
Wed, 1 May 2002 17:10:59 +0000 (17:10 +0000)
committerpschwan <pschwan>
Wed, 1 May 2002 17:10:59 +0000 (17:10 +0000)
lustre/ptlrpc/niobuf.c
lustre/ptlrpc/recovd.c

index 97ecc29..e3386ec 100644 (file)
@@ -235,7 +235,6 @@ void ptlrpc_resend_req(struct ptlrpc_request *req)
         req->rq_flags &= ~PTL_RPC_FL_TIMEOUT;
         wake_up_interruptible(&req->rq_wait_for_rep);
         EXIT;
-        return; 
 }
 
 int ptl_send_rpc(struct ptlrpc_request *request)
index 9547816..7e8e9c4 100644 (file)
@@ -108,7 +108,6 @@ static int recovd_check_event(struct recovd_obd *recovd)
 static int recovd_handle_event(struct recovd_obd *recovd)
 {
         ENTRY;
-        spin_lock(&recovd->recovd_lock);
 
         if (!(recovd->recovd_flags & RECOVD_UPCALL_WAIT) &&
             recovd->recovd_flags & RECOVD_FAIL) { 
@@ -128,26 +127,26 @@ static int recovd_handle_event(struct recovd_obd *recovd)
         }
 
         if (recovd->recovd_flags & RECOVD_UPCALL_ANSWER) { 
-                struct list_head *tmp, *pos;
                 CERROR("UPCALL_WAITING: upcall answer\n");
                 CERROR("** fill me in with recovery\n");
 
-                list_for_each_safe(tmp, pos, &recovd->recovd_troubled_lh) { 
-                        struct ptlrpc_client *cli = list_entry
-                                (tmp, struct ptlrpc_client, cli_ha_item);
+                while (!list_empty(&recovd->recovd_troubled_lh)) {
+                        struct ptlrpc_client *cli =
+                                list_entry(recovd->recovd_troubled_lh.next,
+                                           struct ptlrpc_client, cli_ha_item);
 
                         list_del(&cli->cli_ha_item); 
-                        spin_unlock(&recovd->recovd_lock);
-                        if (cli->cli_recover)
+                        if (cli->cli_recover) {
+                                spin_unlock(&recovd->recovd_lock);
                                 cli->cli_recover(cli); 
-                        spin_lock(&recovd->recovd_lock);
+                                spin_lock(&recovd->recovd_lock);
+                        }
                 }
 
                 recovd->recovd_timeout = 0;
                 recovd->recovd_flags = RECOVD_IDLE; 
         }
 
-        spin_unlock(&recovd->recovd_lock);
         RETURN(0);
 }