Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-10805 ldlm: convert ACCESS_ONCE() to READ_ONCE()
[fs/lustre-release.git]
/
lustre
/
ldlm
/
ldlm_lib.c
diff --git
a/lustre/ldlm/ldlm_lib.c
b/lustre/ldlm/ldlm_lib.c
index
0b0d778
..
27deb36
100644
(file)
--- a/
lustre/ldlm/ldlm_lib.c
+++ b/
lustre/ldlm/ldlm_lib.c
@@
-23,7
+23,7
@@
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2010, 201
6
, Intel Corporation.
+ * Copyright (c) 2010, 201
7
, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
*/
/*
* This file is part of Lustre, http://www.lustre.org/
@@
-39,6
+39,7
@@
#define DEBUG_SUBSYSTEM S_LDLM
#define DEBUG_SUBSYSTEM S_LDLM
+#include <linux/jiffies.h>
#include <linux/kthread.h>
#include <libcfs/libcfs.h>
#include <obd.h>
#include <linux/kthread.h>
#include <libcfs/libcfs.h>
#include <obd.h>
@@
-391,6
+392,9
@@
int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
atomic_long_set(&cli->cl_unstable_count, 0);
INIT_LIST_HEAD(&cli->cl_shrink_list);
atomic_long_set(&cli->cl_unstable_count, 0);
INIT_LIST_HEAD(&cli->cl_shrink_list);
+ 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);
#ifdef ENABLE_CHECKSUM
init_waitqueue_head(&cli->cl_destroy_waitq);
atomic_set(&cli->cl_destroy_in_flight, 0);
#ifdef ENABLE_CHECKSUM
@@
-409,6
+413,8
@@
int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
* from OFD after connecting. */
cli->cl_max_pages_per_rpc = PTLRPC_MAX_BRW_PAGES;
* from OFD after connecting. */
cli->cl_max_pages_per_rpc = PTLRPC_MAX_BRW_PAGES;
+ cli->cl_short_io_bytes = OBD_MAX_SHORT_IO_BYTES;
+
/* set cl_chunkbits default value to PAGE_SHIFT,
* it will be updated at OSC connection time. */
cli->cl_chunkbits = PAGE_SHIFT;
/* set cl_chunkbits default value to PAGE_SHIFT,
* it will be updated at OSC connection time. */
cli->cl_chunkbits = PAGE_SHIFT;
@@
-426,7
+432,7
@@
int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
cli->cl_max_rpcs_in_flight = OBD_MAX_RIF_MAX;
else
cli->cl_max_rpcs_in_flight = OBD_MAX_RIF_DEFAULT;
cli->cl_max_rpcs_in_flight = OBD_MAX_RIF_MAX;
else
cli->cl_max_rpcs_in_flight = OBD_MAX_RIF_DEFAULT;
-
}
+ }
spin_lock_init(&cli->cl_mod_rpcs_lock);
spin_lock_init(&cli->cl_mod_rpcs_hist.oh_lock);
spin_lock_init(&cli->cl_mod_rpcs_lock);
spin_lock_init(&cli->cl_mod_rpcs_hist.oh_lock);
@@
-782,7
+788,8
@@
static int target_handle_reconnect(struct lustre_handle *conn,
}
now = ktime_get_seconds();
}
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;
if (now < deadline) {
struct target_distribute_txn_data *tdtd;
int size = 0;
@@
-1074,7
+1081,8
@@
int target_handle_connect(struct ptlrpc_request *req)
*
* Via check OBD_CONNECT_FID, we can distinguish whether
* the OBD_CONNECT_MDS_MDS/OBD_CONNECT_MNE_SWAB is from
*
* 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) &&
if (!lw_client &&
(data->ocd_connect_flags & OBD_CONNECT_MDS_MDS) &&
(data->ocd_connect_flags & OBD_CONNECT_FID) &&
@@
-1248,8
+1256,8
@@
no_export:
i = atomic_read(&target->obd_lock_replay_clients);
k = target->obd_max_recoverable_clients;
s = target->obd_stale_clients;
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 =
jiffies_to_msecs(target->obd_recovery_timer.expires)
;
+ t
/= MSEC_PER_SEC
;
t -= ktime_get_seconds();
LCONSOLE_WARN("%s: Denying connection for new client %s"
"(at %s), waiting for %d known clients "
t -= ktime_get_seconds();
LCONSOLE_WARN("%s: Denying connection for new client %s"
"(at %s), waiting for %d known clients "
@@
-1571,12
+1579,13
@@
static void target_finish_recovery(struct lu_target *lut)
obd->obd_recovery_end = ktime_get_real_seconds();
/* When recovery finished, cleanup orphans on MDS and OST. */
obd->obd_recovery_end = ktime_get_real_seconds();
/* When recovery finished, cleanup orphans on MDS and OST. */
- if (OBT(obd) && OBP(obd, postrecov)) {
- int rc = OBP(obd, postrecov)(obd);
- if (rc < 0)
- LCONSOLE_WARN("%s: Post recovery failed, rc %d\n",
- obd->obd_name, rc);
- }
+ if (obd->obd_type && OBP(obd, postrecov)) {
+ int rc = OBP(obd, postrecov)(obd);
+
+ if (rc < 0)
+ LCONSOLE_WARN("%s: Post recovery failed, rc %d\n",
+ obd->obd_name, rc);
+ }
EXIT;
}
EXIT;
}
@@
-1960,7
+1969,18
@@
static int target_recovery_overseer(struct lu_target *lut,
{
struct obd_device *obd = lut->lut_obd;
struct target_distribute_txn_data *tdtd;
{
struct obd_device *obd = lut->lut_obd;
struct target_distribute_txn_data *tdtd;
+ time64_t last = 0;
+ time64_t now;
repeat:
repeat:
+ if (obd->obd_recovering && obd->obd_recovery_start == 0) {
+ now = ktime_get_seconds();
+ if (now - last > 600) {
+ LCONSOLE_INFO("%s: in recovery but waiting for "
+ "the first client to connect\n",
+ obd->obd_name);
+ last = now;
+ }
+ }
if (obd->obd_recovery_start != 0 && ktime_get_real_seconds() >=
(obd->obd_recovery_start + obd->obd_recovery_time_hard)) {
__u64 next_update_transno = 0;
if (obd->obd_recovery_start != 0 && ktime_get_real_seconds() >=
(obd->obd_recovery_start + obd->obd_recovery_time_hard)) {
__u64 next_update_transno = 0;
@@
-2676,6
+2696,17
@@
int target_queue_recovery_request(struct ptlrpc_request *req,
target_process_req_flags(obd, req);
if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_LOCK_REPLAY_DONE) {
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);
/* client declares he's ready to complete recovery
* so, we put the request on th final queue */
target_request_copy_get(req);
@@
-3189,7
+3220,7
@@
int target_bulk_io(struct obd_export *exp, struct ptlrpc_bulk_desc *desc,
lwi);
LASSERT(rc == 0 || rc == -ETIMEDOUT);
/* Wait again if we changed rq_deadline. */
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;
deadline = start + bulk_timeout;
if (deadline > rq_deadline)
deadline = rq_deadline;