diff options
Diffstat (limited to 'drivers/staging/lustre/lustre/ptlrpc/import.c')
-rw-r--r-- | drivers/staging/lustre/lustre/ptlrpc/import.c | 174 |
1 files changed, 87 insertions, 87 deletions
diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c index f752c789bda0..b4eddf291269 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/import.c +++ b/drivers/staging/lustre/lustre/ptlrpc/import.c @@ -112,7 +112,8 @@ int ptlrpc_import_recovery_state_machine(struct obd_import *imp); * CLOSED. I would rather refcount the import and free it after * disconnection like we do with exports. To do that, the client_obd * will need to save the peer info somewhere other than in the import, - * though. */ + * though. + */ int ptlrpc_init_import(struct obd_import *imp) { spin_lock(&imp->imp_lock); @@ -139,7 +140,7 @@ static void deuuidify(char *uuid, const char *prefix, char **uuid_start, return; if (!strncmp(*uuid_start + *uuid_len - strlen(UUID_STR), - UUID_STR, strlen(UUID_STR))) + UUID_STR, strlen(UUID_STR))) *uuid_len -= strlen(UUID_STR); } @@ -282,11 +283,13 @@ void ptlrpc_invalidate_import(struct obd_import *imp) /* Wait forever until inflight == 0. We really can't do it another * way because in some cases we need to wait for very long reply * unlink. We can't do anything before that because there is really - * no guarantee that some rdma transfer is not in progress right now. */ + * no guarantee that some rdma transfer is not in progress right now. + */ do { /* Calculate max timeout for waiting on rpcs to error * out. Use obd_timeout if calculated value is smaller - * than it. */ + * than it. + */ if (!OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_LONG_REPL_UNLINK)) { timeout = ptlrpc_inflight_timeout(imp); timeout += timeout / 3; @@ -304,7 +307,8 @@ void ptlrpc_invalidate_import(struct obd_import *imp) /* Wait for all requests to error out and call completion * callbacks. Cap it at obd_timeout -- these should all - * have been locally cancelled by ptlrpc_abort_inflight. */ + * have been locally cancelled by ptlrpc_abort_inflight. + */ lwi = LWI_TIMEOUT_INTERVAL( cfs_timeout_cap(cfs_time_seconds(timeout)), (timeout > 1)?cfs_time_seconds(1):cfs_time_seconds(1)/2, @@ -328,28 +332,30 @@ void ptlrpc_invalidate_import(struct obd_import *imp) * maybe waiting for long reply unlink in * sluggish nets). Let's check this. If there * is no inflight and unregistering != 0, this - * is bug. */ + * is bug. + */ LASSERTF(count == 0, "Some RPCs are still unregistering: %d\n", count); /* Let's save one loop as soon as inflight have * dropped to zero. No new inflights possible at - * this point. */ + * this point. + */ rc = 0; } else { list_for_each_safe(tmp, n, - &imp->imp_sending_list) { + &imp->imp_sending_list) { req = list_entry(tmp, - struct ptlrpc_request, - rq_list); + struct ptlrpc_request, + rq_list); DEBUG_REQ(D_ERROR, req, "still on sending list"); } list_for_each_safe(tmp, n, - &imp->imp_delayed_list) { + &imp->imp_delayed_list) { req = list_entry(tmp, - struct ptlrpc_request, - rq_list); + struct ptlrpc_request, + rq_list); DEBUG_REQ(D_ERROR, req, "still on delayed list"); } @@ -427,7 +433,6 @@ EXPORT_SYMBOL(ptlrpc_fail_import); int ptlrpc_reconnect_import(struct obd_import *imp) { -#ifdef ENABLE_PINGER struct l_wait_info lwi; int secs = cfs_time_seconds(obd_timeout); int rc; @@ -443,33 +448,6 @@ int ptlrpc_reconnect_import(struct obd_import *imp) CDEBUG(D_HA, "%s: recovery finished s:%s\n", obd2cli_tgt(imp->imp_obd), ptlrpc_import_state_name(imp->imp_state)); return rc; -#else - ptlrpc_set_import_discon(imp, 0); - /* Force a new connect attempt */ - ptlrpc_invalidate_import(imp); - /* Do a fresh connect next time by zeroing the handle */ - ptlrpc_disconnect_import(imp, 1); - /* Wait for all invalidate calls to finish */ - if (atomic_read(&imp->imp_inval_count) > 0) { - int rc; - struct l_wait_info lwi = LWI_INTR(LWI_ON_SIGNAL_NOOP, NULL); - - rc = l_wait_event(imp->imp_recovery_waitq, - (atomic_read(&imp->imp_inval_count) == 0), - &lwi); - if (rc) - CERROR("Interrupted, inval=%d\n", - atomic_read(&imp->imp_inval_count)); - } - - /* Allow reconnect attempts */ - imp->imp_obd->obd_no_recov = 0; - /* Remove 'invalid' flag */ - ptlrpc_activate_import(imp); - /* Attempt a new connect */ - ptlrpc_recover_import(imp, NULL, 0); - return 0; -#endif } EXPORT_SYMBOL(ptlrpc_reconnect_import); @@ -501,18 +479,20 @@ static int import_select_connection(struct obd_import *imp) conn->oic_last_attempt); /* If we have not tried this connection since - the last successful attempt, go with this one */ + * the last successful attempt, go with this one + */ if ((conn->oic_last_attempt == 0) || cfs_time_beforeq_64(conn->oic_last_attempt, - imp->imp_last_success_conn)) { + imp->imp_last_success_conn)) { imp_conn = conn; tried_all = 0; break; } /* If all of the connections have already been tried - since the last successful connection; just choose the - least recently used */ + * since the last successful connection; just choose the + * least recently used + */ if (!imp_conn) imp_conn = conn; else if (cfs_time_before_64(conn->oic_last_attempt, @@ -529,10 +509,11 @@ static int import_select_connection(struct obd_import *imp) LASSERT(imp_conn->oic_conn); /* If we've tried everything, and we're back to the beginning of the - list, increase our timeout and try again. It will be reset when - we do finally connect. (FIXME: really we should wait for all network - state associated with the last connection attempt to drain before - trying to reconnect on it.) */ + * list, increase our timeout and try again. It will be reset when + * we do finally connect. (FIXME: really we should wait for all network + * state associated with the last connection attempt to drain before + * trying to reconnect on it.) + */ if (tried_all && (imp->imp_conn_list.next == &imp_conn->oic_item)) { struct adaptive_timeout *at = &imp->imp_at.iat_net_latency; @@ -553,7 +534,6 @@ static int import_select_connection(struct obd_import *imp) imp->imp_connection = ptlrpc_connection_addref(imp_conn->oic_conn); dlmexp = class_conn2export(&imp->imp_dlm_handle); - LASSERT(dlmexp != NULL); ptlrpc_connection_put(dlmexp->exp_connection); dlmexp->exp_connection = ptlrpc_connection_addref(imp_conn->oic_conn); class_export_put(dlmexp); @@ -590,7 +570,8 @@ static int ptlrpc_first_transno(struct obd_import *imp, __u64 *transno) struct list_head *tmp; /* The requests in committed_list always have smaller transnos than - * the requests in replay_list */ + * the requests in replay_list + */ if (!list_empty(&imp->imp_committed_list)) { tmp = imp->imp_committed_list.next; req = list_entry(tmp, struct ptlrpc_request, rq_replay_list); @@ -674,7 +655,8 @@ int ptlrpc_connect_import(struct obd_import *imp) goto out; /* Reset connect flags to the originally requested flags, in case - * the server is updated on-the-fly we will get the new features. */ + * the server is updated on-the-fly we will get the new features. + */ imp->imp_connect_data.ocd_connect_flags = imp->imp_connect_flags_orig; /* Reset ocd_version each time so the server knows the exact versions */ imp->imp_connect_data.ocd_version = LUSTRE_VERSION_CODE; @@ -687,7 +669,7 @@ int ptlrpc_connect_import(struct obd_import *imp) goto out; request = ptlrpc_request_alloc(imp, &RQF_MDS_CONNECT); - if (request == NULL) { + if (!request) { rc = -ENOMEM; goto out; } @@ -700,7 +682,8 @@ int ptlrpc_connect_import(struct obd_import *imp) } /* Report the rpc service time to the server so that it knows how long - * to wait for clients to join recovery */ + * to wait for clients to join recovery + */ lustre_msg_set_service_time(request->rq_reqmsg, at_timeout2est(request->rq_timeout)); @@ -708,7 +691,8 @@ int ptlrpc_connect_import(struct obd_import *imp) * import_select_connection will increase the net latency on * repeated reconnect attempts to cover slow networks. * We override/ignore the server rpc completion estimate here, - * which may be large if this is a reconnect attempt */ + * which may be large if this is a reconnect attempt + */ request->rq_timeout = INITIAL_CONNECT_TIMEOUT; lustre_msg_set_timeout(request->rq_reqmsg, request->rq_timeout); @@ -799,7 +783,8 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, if (rc) { /* if this reconnect to busy export - not need select new target - * for connecting*/ + * for connecting + */ imp->imp_force_reconnect = ptlrpc_busy_reconnect(rc); spin_unlock(&imp->imp_lock); ptlrpc_maybe_ping_import_soon(imp); @@ -817,7 +802,7 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, ocd = req_capsule_server_sized_get(&request->rq_pill, &RMF_CONNECT_DATA, ret); - if (ocd == NULL) { + if (!ocd) { CERROR("%s: no connect data from server\n", imp->imp_obd->obd_name); rc = -EPROTO; @@ -851,7 +836,8 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, if (!exp) { /* This could happen if export is cleaned during the - connect attempt */ + * connect attempt + */ CERROR("%s: missing export after connect\n", imp->imp_obd->obd_name); rc = -ENODEV; @@ -877,14 +863,16 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, } /* if applies, adjust the imp->imp_msg_magic here - * according to reply flags */ + * according to reply flags + */ imp->imp_remote_handle = *lustre_msg_get_handle(request->rq_repmsg); /* Initial connects are allowed for clients with non-random * uuids when servers are in recovery. Simply signal the - * servers replay is complete and wait in REPLAY_WAIT. */ + * servers replay is complete and wait in REPLAY_WAIT. + */ if (msg_flags & MSG_CONNECT_RECOVERING) { CDEBUG(D_HA, "connect to %s during recovery\n", obd2cli_tgt(imp->imp_obd)); @@ -923,7 +911,8 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, * already erased all of our state because of previous * eviction. If it is in recovery - we are safe to * participate since we can reestablish all of our state - * with server again */ + * with server again + */ if ((msg_flags & MSG_CONNECT_RECOVERING)) { CDEBUG(level, "%s@%s changed server handle from %#llx to %#llx but is still in recovery\n", obd2cli_tgt(imp->imp_obd), @@ -1015,8 +1004,7 @@ finish: spin_lock(&imp->imp_lock); list_del(&imp->imp_conn_current->oic_item); - list_add(&imp->imp_conn_current->oic_item, - &imp->imp_conn_list); + list_add(&imp->imp_conn_current->oic_item, &imp->imp_conn_list); imp->imp_last_success_conn = imp->imp_conn_current->oic_last_attempt; @@ -1039,7 +1027,8 @@ finish: ocd->ocd_version < LUSTRE_VERSION_CODE - LUSTRE_VERSION_OFFSET_WARN)) { /* Sigh, some compilers do not like #ifdef in the middle - of macro arguments */ + * of macro arguments + */ const char *older = "older. Consider upgrading server or downgrading client" ; const char *newer = "newer than client version. Consider upgrading client" @@ -1061,7 +1050,8 @@ finish: * fixup is version-limited, because we don't want to carry the * OBD_CONNECT_MNE_SWAB flag around forever, just so long as we * need interop with unpatched 2.2 servers. For newer servers, - * the client will do MNE swabbing only as needed. LU-1644 */ + * the client will do MNE swabbing only as needed. LU-1644 + */ if (unlikely((ocd->ocd_connect_flags & OBD_CONNECT_VERSION) && !(ocd->ocd_connect_flags & OBD_CONNECT_MNE_SWAB) && OBD_OCD_VERSION_MAJOR(ocd->ocd_version) == 2 && @@ -1079,7 +1069,8 @@ finish: if (ocd->ocd_connect_flags & OBD_CONNECT_CKSUM) { /* We sent to the server ocd_cksum_types with bits set * for algorithms we understand. The server masked off - * the checksum types it doesn't support */ + * the checksum types it doesn't support + */ if ((ocd->ocd_cksum_types & cksum_types_supported_client()) == 0) { LCONSOLE_WARN("The negotiation of the checksum algorithm to use with server %s failed (%x/%x), disabling checksums\n", @@ -1093,7 +1084,8 @@ finish: } } else { /* The server does not support OBD_CONNECT_CKSUM. - * Enforce ADLER for backward compatibility*/ + * Enforce ADLER for backward compatibility + */ cli->cl_supp_cksum_types = OBD_CKSUM_ADLER; } cli->cl_cksum_type = cksum_type_select(cli->cl_supp_cksum_types); @@ -1109,7 +1101,8 @@ finish: /* Reset ns_connect_flags only for initial connect. It might be * changed in while using FS and if we reset it in reconnect * this leads to losing user settings done before such as - * disable lru_resize, etc. */ + * disable lru_resize, etc. + */ if (old_connect_flags != exp_connect_flags(exp) || aa->pcaa_initial_connect) { CDEBUG(D_HA, "%s: Resetting ns_connect_flags to server flags: %#llx\n", @@ -1123,13 +1116,14 @@ finish: if ((ocd->ocd_connect_flags & OBD_CONNECT_AT) && (imp->imp_msg_magic == LUSTRE_MSG_MAGIC_V2)) /* We need a per-message support flag, because - a. we don't know if the incoming connect reply - supports AT or not (in reply_in_callback) - until we unpack it. - b. failovered server means export and flags are gone - (in ptlrpc_send_reply). - Can only be set when we know AT is supported at - both ends */ + * a. we don't know if the incoming connect reply + * supports AT or not (in reply_in_callback) + * until we unpack it. + * b. failovered server means export and flags are gone + * (in ptlrpc_send_reply). + * Can only be set when we know AT is supported at + * both ends + */ imp->imp_msghdr_flags |= MSGHDR_AT_SUPPORT; else imp->imp_msghdr_flags &= ~MSGHDR_AT_SUPPORT; @@ -1162,7 +1156,7 @@ out: struct obd_connect_data *ocd; /* reply message might not be ready */ - if (request->rq_repmsg == NULL) + if (!request->rq_repmsg) return -EPROTO; ocd = req_capsule_server_get(&request->rq_pill, @@ -1243,7 +1237,7 @@ static int signal_completed_replay(struct obd_import *imp) req = ptlrpc_request_alloc_pack(imp, &RQF_OBD_PING, LUSTRE_OBD_VERSION, OBD_PING); - if (req == NULL) { + if (!req) { atomic_dec(&imp->imp_replay_inflight); return -ENOMEM; } @@ -1337,12 +1331,13 @@ int ptlrpc_import_recovery_state_machine(struct obd_import *imp) { struct task_struct *task; /* bug 17802: XXX client_disconnect_export vs connect request - * race. if client will evicted at this time, we start + * race. if client is evicted at this time, we start * invalidate thread without reference to import and import can - * be freed at same time. */ + * be freed at same time. + */ class_import_get(imp); task = kthread_run(ptlrpc_invalidate_import_thread, imp, - "ll_imp_inval"); + "ll_imp_inval"); if (IS_ERR(task)) { class_import_put(imp); CERROR("error starting invalidate thread: %d\n", rc); @@ -1471,11 +1466,13 @@ int ptlrpc_disconnect_import(struct obd_import *imp, int noclose) if (req) { /* We are disconnecting, do not retry a failed DISCONNECT rpc if * it fails. We can get through the above with a down server - * if the client doesn't know the server is gone yet. */ + * if the client doesn't know the server is gone yet. + */ req->rq_no_resend = 1; /* We want client umounts to happen quickly, no matter the - server state... */ + * server state... + */ req->rq_timeout = min_t(int, req->rq_timeout, INITIAL_CONNECT_TIMEOUT); @@ -1507,9 +1504,10 @@ EXPORT_SYMBOL(ptlrpc_disconnect_import); extern unsigned int at_min, at_max, at_history; /* Bin into timeslices using AT_BINS bins. - This gives us a max of the last binlimit*AT_BINS secs without the storage, - but still smoothing out a return to normalcy from a slow response. - (E.g. remember the maximum latency in each minute of the last 4 minutes.) */ + * This gives us a max of the last binlimit*AT_BINS secs without the storage, + * but still smoothing out a return to normalcy from a slow response. + * (E.g. remember the maximum latency in each minute of the last 4 minutes.) + */ int at_measured(struct adaptive_timeout *at, unsigned int val) { unsigned int old = at->at_current; @@ -1523,7 +1521,8 @@ int at_measured(struct adaptive_timeout *at, unsigned int val) if (val == 0) /* 0's don't count, because we never want our timeout to - drop to 0, and because 0 could mean an error */ + * drop to 0, and because 0 could mean an error + */ return 0; spin_lock(&at->at_lock); @@ -1565,7 +1564,8 @@ int at_measured(struct adaptive_timeout *at, unsigned int val) if (at->at_flags & AT_FLG_NOHIST) /* Only keep last reported val; keeping the rest of the history - for proc only */ + * for debugfs only + */ at->at_current = val; if (at_max > 0) |