* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2010, 2016, Intel Corporation.
+ * Copyright (c) 2010, 2017, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
#define DEBUG_SUBSYSTEM S_LDLM
+#include <linux/jiffies.h>
#include <linux/kthread.h>
#include <libcfs/libcfs.h>
#include <obd.h>
spin_lock_init(&cli->cl_lru_list_lock);
atomic_long_set(&cli->cl_unstable_count, 0);
INIT_LIST_HEAD(&cli->cl_shrink_list);
+ INIT_LIST_HEAD(&cli->cl_grant_chain);
INIT_LIST_HEAD(&cli->cl_flight_waiters);
cli->cl_rpcs_in_flight = 0;
init_waitqueue_head(&cli->cl_destroy_waitq);
atomic_set(&cli->cl_destroy_in_flight, 0);
+
+ cli->cl_supp_cksum_types = OBD_CKSUM_CRC32;
#ifdef ENABLE_CHECKSUM
/* Turn on checksumming by default. */
cli->cl_checksum = 1;
* Set cl_chksum* to CRC32 for now to avoid returning screwed info
* through procfs.
*/
- cli->cl_cksum_type = cli->cl_supp_cksum_types = OBD_CKSUM_CRC32;
+ cli->cl_cksum_type = cli->cl_supp_cksum_types;
#endif
atomic_set(&cli->cl_resends, OSC_DEFAULT_RESENDS);
* from OFD after connecting. */
cli->cl_max_pages_per_rpc = PTLRPC_MAX_BRW_PAGES;
- cli->cl_short_io_bytes = OBD_MAX_SHORT_IO_BYTES;
+ cli->cl_max_short_io_bytes = OBD_MAX_SHORT_IO_BYTES;
/* set cl_chunkbits default value to PAGE_SHIFT,
* it will be updated at OSC connection time. */
}
now = ktime_get_seconds();
- deadline = cfs_duration_sec(target->obd_recovery_timer.expires);
+ deadline = jiffies_to_msecs(target->obd_recovery_timer.expires) /
+ MSEC_PER_SEC;
if (now < deadline) {
struct target_distribute_txn_data *tdtd;
int size = 0;
*
* Via check OBD_CONNECT_FID, we can distinguish whether
* the OBD_CONNECT_MDS_MDS/OBD_CONNECT_MNE_SWAB is from
- * MGC or MDT. */
+ * MGC or MDT, since MGC does not use OBD_CONNECT_FID.
+ */
if (!lw_client &&
(data->ocd_connect_flags & OBD_CONNECT_MDS_MDS) &&
(data->ocd_connect_flags & OBD_CONNECT_FID) &&
* cause namespace inconsistency */
spin_lock(&export->exp_lock);
export->exp_connecting = 1;
+ export->exp_conn_cnt = 0;
spin_unlock(&export->exp_lock);
conn.cookie = export->exp_handle.h_cookie;
rc = EALREADY;
target->obd_name, cluuid.uuid,
libcfs_nid2str(req->rq_peer.nid),
atomic_read(&export->exp_refcount));
- GOTO(out, rc = -EBUSY);
- } else if (lustre_msg_get_conn_cnt(req->rq_reqmsg) == 1) {
- if (!strstr(cluuid.uuid, "mdt"))
- LCONSOLE_WARN("%s: Rejecting reconnect from the "
- "known client %s (at %s) because it "
- "is indicating it is a new client",
- target->obd_name, cluuid.uuid,
- libcfs_nid2str(req->rq_peer.nid));
- GOTO(out, rc = -EALREADY);
- } else {
- OBD_FAIL_TIMEOUT(OBD_FAIL_TGT_DELAY_RECONNECT, 2 * obd_timeout);
- }
+ GOTO(out, rc = -EBUSY);
+ } else if (lustre_msg_get_conn_cnt(req->rq_reqmsg) == 1 &&
+ rc != EALREADY) {
+ if (!strstr(cluuid.uuid, "mdt"))
+ LCONSOLE_WARN("%s: Rejecting reconnect from the "
+ "known client %s (at %s) because it "
+ "is indicating it is a new client",
+ target->obd_name, cluuid.uuid,
+ libcfs_nid2str(req->rq_peer.nid));
+ GOTO(out, rc = -EALREADY);
+ } else {
+ OBD_FAIL_TIMEOUT(OBD_FAIL_TGT_DELAY_RECONNECT, 2 * obd_timeout);
+ }
if (rc < 0) {
GOTO(out, rc);
/* allow "new" MDT to be connected during recovery, since we
* need retrieve recovery update records from it */
if (target->obd_recovering && !lw_client && !mds_mds_conn) {
+ time64_t now;
time64_t t;
+ char *msg;
int c; /* connected */
int i; /* in progress */
int k; /* known */
i = atomic_read(&target->obd_lock_replay_clients);
k = target->obd_max_recoverable_clients;
s = target->obd_stale_clients;
- t = target->obd_recovery_timer.expires;
- t = cfs_duration_sec(target->obd_recovery_timer.expires);
- t -= ktime_get_seconds();
+ t = jiffies_to_msecs(target->obd_recovery_timer.expires);
+ t /= MSEC_PER_SEC;
+ now = ktime_get_seconds();
+ if (now > t) {
+ t = now - t;
+ msg = "already passed deadline";
+ } else {
+ t -= now;
+ msg = "to recover in";
+ }
+
LCONSOLE_WARN("%s: Denying connection for new client %s"
"(at %s), waiting for %d known clients "
"(%d recovered, %d in progress, and %d "
- "evicted) to recover in %lld:%.02lld\n",
+ "evicted) %s %lld:%.02lld\n",
target->obd_name, cluuid.uuid,
libcfs_nid2str(req->rq_peer.nid), k,
- c - i, i, s, t / 60, t % 60);
+ c - i, i, s, msg, t / 60, t % 60);
rc = -EBUSY;
} else {
dont_check_exports:
}
EXPORT_SYMBOL(target_recovery_fini);
-static void target_recovery_expired(unsigned long castmeharder)
+static void target_recovery_expired(cfs_timer_cb_arg_t data)
{
- struct obd_device *obd = (struct obd_device *)castmeharder;
+ struct obd_device *obd = cfs_from_timer(obd, data, obd_recovery_timer);
CDEBUG(D_HA, "%s: recovery timed out; %d clients are still in recovery"
" after %llus (%d clients connected)\n",
obd->obd_name, atomic_read(&obd->obd_lock_replay_clients),
obd->obd_recovery_start = 0;
obd->obd_recovery_end = 0;
- setup_timer(&obd->obd_recovery_timer, target_recovery_expired,
- (unsigned long)obd);
+ cfs_timer_setup(&obd->obd_recovery_timer, target_recovery_expired,
+ (unsigned long)obd, 0);
target_start_recovery_thread(lut, handler);
}
EXPORT_SYMBOL(target_recovery_init);
target_process_req_flags(obd, req);
if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_LOCK_REPLAY_DONE) {
+ if (unlikely(OBD_FAIL_CHECK(OBD_FAIL_TGT_RECOVERY_REQ_RACE))) {
+ if (cfs_fail_val == 1) {
+ cfs_race_state = 1;
+ cfs_fail_val = 0;
+ wake_up(&cfs_race_waitq);
+
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(cfs_time_seconds(1));
+ }
+ }
+
/* client declares he's ready to complete recovery
* so, we put the request on th final queue */
target_request_copy_get(req);
lwi);
LASSERT(rc == 0 || rc == -ETIMEDOUT);
/* Wait again if we changed rq_deadline. */
- rq_deadline = ACCESS_ONCE(req->rq_deadline);
+ rq_deadline = READ_ONCE(req->rq_deadline);
deadline = start + bulk_timeout;
if (deadline > rq_deadline)
deadline = rq_deadline;