Whamcloud - gitweb
Branch b1_4
authoradilger <adilger>
Thu, 11 Aug 2005 00:24:19 +0000 (00:24 +0000)
committeradilger <adilger>
Thu, 11 Aug 2005 00:24:19 +0000 (00:24 +0000)
Add check for NULL imp_conn_current.  It isn't clear whether this should
always be non-NULL (in which case locking is bad, though we can't really
expect to hold imp_lock over the whole operation) or whether it is OK
to handle the NULL case gracefully.
b=7269
r=jacob

lustre/ptlrpc/import.c

index 154031e..fe8c5fb 100644 (file)
@@ -262,9 +262,9 @@ static int import_select_connection(struct obd_import *imp)
         }
 
         if (imp->imp_conn_current && 
-            !(imp->imp_conn_current->oic_item.next == &imp->imp_conn_list)) {
+            imp->imp_conn_current->oic_item.next != &imp->imp_conn_list) {
                 imp_conn = list_entry(imp->imp_conn_current->oic_item.next,
-                                  struct obd_import_conn, oic_item);
+                                      struct obd_import_conn, oic_item);
         } else {
                 imp_conn = list_entry(imp->imp_conn_list.next,
                                       struct obd_import_conn, oic_item);
@@ -529,10 +529,21 @@ finish:
                         RETURN(0);
                 }
         } else {
-                list_del(&imp->imp_conn_current->oic_item);
-                list_add(&imp->imp_conn_current->oic_item,
-                         &imp->imp_conn_list);
-                imp->imp_conn_current = NULL;
+                spin_lock_irqsave(&imp->imp_lock, flags);
+                if (imp->imp_conn_current != NULL) {
+                        list_del(&imp->imp_conn_current->oic_item);
+                        list_add(&imp->imp_conn_current->oic_item,
+                                 &imp->imp_conn_list);
+                        imp->imp_conn_current = NULL;
+                        spin_unlock_irqrestore(&imp->imp_lock, flags);
+                } else {
+                        static int bug7269_dump = 0;
+                        spin_unlock_irqrestore(&imp->imp_lock, flags);
+                        CERROR("this is bug 7269 - please attach log there\n");
+                        if (bug7269_dump == 0)
+                                portals_debug_dumplog();
+                        bug7269_dump = 1;
+                }
         }
 
  out:
@@ -543,7 +554,7 @@ finish:
                 }
 
                 ptlrpc_maybe_ping_import_soon(imp);
-                
+
                 CDEBUG(D_HA, "recovery of %s on %s failed (%d)\n",
                        imp->imp_target_uuid.uuid,
                        (char *)imp->imp_connection->c_remote_uuid.uuid, rc);