From: adilger Date: Thu, 11 Aug 2005 00:24:19 +0000 (+0000) Subject: Branch b1_4 X-Git-Tag: v1_7_140~1^12~3^2~55^5~33 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=099d79b3dd601abaae25b8065c5b9869ddba9d72;p=fs%2Flustre-release.git Branch b1_4 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 --- diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index 154031e..fe8c5fb 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -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);