X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fptlrpc%2Fimport.c;h=1a461f1e5c414385769540b55fcfc35b2971639b;hp=272d86cf107df09089b05b61a591e25ad4f859f4;hb=fbe66c3a22bfa136c077cbd46c4186ecbf4946d2;hpb=cc2f3bb6f2bf7a77a3176f240e00f38245d12242 diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index 272d86c..1a461f1 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -476,6 +476,12 @@ static int import_select_connection(struct obd_import *imp) imp->imp_obd->obd_name, libcfs_nid2str(conn->oic_conn->c_peer.nid), conn->oic_last_attempt); + /* Don't thrash connections */ + if (cfs_time_before_64(cfs_time_current_64(), + conn->oic_last_attempt + + cfs_time_seconds(CONNECTION_SWITCH_MIN))) { + continue; + } /* If we have not tried this connection since the last successful attempt, go with this one */ @@ -726,12 +732,42 @@ EXPORT_SYMBOL(ptlrpc_connect_import); static void ptlrpc_maybe_ping_import_soon(struct obd_import *imp) { #ifdef __KERNEL__ - /* the pinger takes care of issuing the next reconnect request */ - return; + struct obd_import_conn *imp_conn; +#endif + int wake_pinger = 0; + + ENTRY; + + cfs_spin_lock(&imp->imp_lock); + if (cfs_list_empty(&imp->imp_conn_list)) + GOTO(unlock, 0); + +#ifdef __KERNEL__ + imp_conn = cfs_list_entry(imp->imp_conn_list.prev, + struct obd_import_conn, + oic_item); + + /* XXX: When the failover node is the primary node, it is possible + * to have two identical connections in imp_conn_list. We must + * compare not conn's pointers but NIDs, otherwise we can defeat + * connection throttling. (See bug 14774.) */ + if (imp->imp_conn_current->oic_conn->c_peer.nid != + imp_conn->oic_conn->c_peer.nid) { + ptlrpc_ping_import_soon(imp); + wake_pinger = 1; + } #else /* liblustre has no pinger thread, so we wakeup pinger anyway */ - ptlrpc_pinger_wake_up(); + wake_pinger = 1; #endif + + unlock: + cfs_spin_unlock(&imp->imp_lock); + + if (wake_pinger) + ptlrpc_pinger_wake_up(); + + EXIT; } static int ptlrpc_busy_reconnect(int rc)