return snprintf(page, count, "%s\n",obd->u.mds.mds_vfsmnt->mnt_devname);
}
+static int lprocfs_mds_rd_evictostnids(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct obd_device* obd = (struct obd_device *)data;
+
+ LASSERT(obd != NULL);
+
+ return snprintf(page, count, "%d\n", obd->u.mds.mds_evict_ost_nids);
+}
+
+static int lprocfs_mds_wr_evictostnids(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct obd_device *obd = data;
+ int val, rc;
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc)
+ return rc;
+
+ obd->u.mds.mds_evict_ost_nids = !!val;
+
+ return count;
+}
+
static int lprocfs_mds_wr_evict_client(struct file *file, const char *buffer,
unsigned long count, void *data)
{
if (!set)
return -ENOMEM;
- rc = obd_set_info_async(mds->mds_osc_exp, strlen("evict_by_nid"),
- "evict_by_nid", strlen(tmpbuf + 4) + 1,
- tmpbuf + 4, set);
- if (rc)
- CERROR("Failed to evict nid %s from OSTs: rc %d\n", tmpbuf + 4,
- rc);
+ if (obd->u.mds.mds_evict_ost_nids) {
+ rc = obd_set_info_async(mds->mds_osc_exp,strlen("evict_by_nid"),
+ "evict_by_nid", strlen(tmpbuf + 4) + 1,
+ tmpbuf + 4, set);
+ if (rc)
+ CERROR("Failed to evict nid %s from OSTs: rc %d\n",
+ tmpbuf + 4, rc);
- ptlrpc_check_set(set);
+ ptlrpc_check_set(set);
+ }
/* See the comments in function lprocfs_wr_evict_client()
* in ptlrpc/lproc_ptlrpc.c for details. - jay */
{ "mntdev", lprocfs_mds_rd_mntdev, 0, 0 },
{ "recovery_status", lprocfs_obd_rd_recovery_status, 0, 0 },
{ "evict_client", 0, lprocfs_mds_wr_evict_client, 0 },
+ { "evict_ost_nids", lprocfs_mds_rd_evictostnids,
+ lprocfs_mds_wr_evictostnids, 0 },
{ "num_exports", lprocfs_rd_num_exports, 0, 0 },
#ifdef HAVE_QUOTA_SUPPORT
{ "quota_bunit_sz", lprocfs_rd_bunit, lprocfs_wr_bunit, 0 },
static int ost_brw_read(struct ptlrpc_request *req, struct obd_trans_info *oti)
{
struct ptlrpc_bulk_desc *desc;
+ struct obd_export *exp = req->rq_export;
struct niobuf_remote *remote_nb;
struct niobuf_remote *pp_rnb = NULL;
struct niobuf_local *local_nb;
OBD_FAIL_TIMEOUT(OBD_FAIL_OST_BRW_PAUSE_BULK | OBD_FAIL_ONCE,
(obd_timeout + 1) / 4);
+ /* Check if there is eviction in progress, and if so, wait for it to
+ * finish */
+ if (unlikely(atomic_read(&exp->exp_obd->obd_evict_inprogress))) {
+ lwi = LWI_INTR(NULL, NULL); // We do not care how long it takes
+ rc = l_wait_event(exp->exp_obd->obd_evict_inprogress_waitq,
+ !atomic_read(&exp->exp_obd->obd_evict_inprogress),
+ &lwi);
+ }
+ if (exp->exp_failed)
+ GOTO(out, rc = -ENOTCONN);
+
body = lustre_swab_reqbuf(req, REQ_REC_OFF, sizeof(*body),
lustre_swab_ost_body);
if (body == NULL) {
if (desc == NULL)
GOTO(out, rc = -ENOMEM);
- rc = ost_brw_lock_get(LCK_PR, req->rq_export, ioo, pp_rnb, &lockh);
+ rc = ost_brw_lock_get(LCK_PR, exp, ioo, pp_rnb, &lockh);
if (rc != 0)
GOTO(out_bulk, rc);
GOTO(out_lock, rc = -ETIMEDOUT);
}
- rc = obd_preprw(OBD_BRW_READ, req->rq_export, &body->oa, 1,
+ rc = obd_preprw(OBD_BRW_READ, exp, &body->oa, 1,
ioo, npages, pp_rnb, local_nb, oti, capa);
if (rc != 0)
GOTO(out_lock, rc);
- ost_prolong_locks(req->rq_export, ioo, pp_rnb, LCK_PW | LCK_PR);
+ ost_prolong_locks(exp, ioo, pp_rnb, LCK_PW | LCK_PR);
nob = 0;
for (i = 0; i < npages; i++) {
/* Check if client was evicted while we were doing i/o before touching
network */
if (rc == 0) {
- if (desc->bd_export->exp_failed)
+ /* Check if there is eviction in progress, and if so, wait for
+ * it to finish */
+ if (unlikely(atomic_read(&exp->exp_obd->
+ obd_evict_inprogress))) {
+ lwi = LWI_INTR(NULL, NULL);
+ rc = l_wait_event(exp->exp_obd->
+ obd_evict_inprogress_waitq,
+ !atomic_read(&exp->exp_obd->
+ obd_evict_inprogress),
+ &lwi);
+ }
+ if (exp->exp_failed)
rc = -ENOTCONN;
else {
sptlrpc_svc_wrap_bulk(req, desc);
ost_bulk_timeout, desc);
rc = l_wait_event(desc->bd_waitq,
!ptlrpc_bulk_active(desc) ||
- desc->bd_export->exp_failed, &lwi);
+ exp->exp_failed, &lwi);
LASSERT(rc == 0 || rc == -ETIMEDOUT);
if (rc == -ETIMEDOUT) {
DEBUG_REQ(D_ERROR, req, "timeout on bulk PUT");
ptlrpc_abort_bulk(desc);
- } else if (desc->bd_export->exp_failed) {
+ } else if (exp->exp_failed) {
DEBUG_REQ(D_ERROR, req, "Eviction on bulk PUT");
rc = -ENOTCONN;
ptlrpc_abort_bulk(desc);
}
/* Must commit after prep above in all cases */
- rc = obd_commitrw(OBD_BRW_READ, req->rq_export, &body->oa, 1,
+ rc = obd_commitrw(OBD_BRW_READ, exp, &body->oa, 1,
ioo, npages, local_nb, oti, rc);
ost_nio_pages_put(req, local_nb, npages);
}
CWARN("%s: ignoring bulk IO comm error with %s@%s id %s - "
"client will retry\n",
- req->rq_export->exp_obd->obd_name,
- req->rq_export->exp_client_uuid.uuid,
- req->rq_export->exp_connection->c_remote_uuid.uuid,
+ exp->exp_obd->obd_name,
+ exp->exp_client_uuid.uuid,
+ exp->exp_connection->c_remote_uuid.uuid,
libcfs_id2str(req->rq_peer));
}
static int ost_brw_write(struct ptlrpc_request *req, struct obd_trans_info *oti)
{
struct ptlrpc_bulk_desc *desc;
+ struct obd_export *exp = req->rq_export;
struct niobuf_remote *remote_nb;
struct niobuf_remote *pp_rnb;
struct niobuf_local *local_nb;
OBD_FAIL_TIMEOUT(OBD_FAIL_OST_BRW_PAUSE_BULK | OBD_FAIL_ONCE,
(obd_timeout + 1) / 4);
+ /* Check if there is eviction in progress, and if so, wait for it to
+ * finish */
+ if (unlikely(atomic_read(&exp->exp_obd->obd_evict_inprogress))) {
+ lwi = LWI_INTR(NULL, NULL); // We do not care how long it takes
+ rc = l_wait_event(exp->exp_obd->obd_evict_inprogress_waitq,
+ !atomic_read(&exp->exp_obd->obd_evict_inprogress),
+ &lwi);
+ }
+ if (exp->exp_failed)
+ GOTO(out, rc = -ENOTCONN);
+
swab = lustre_msg_swabbed(req->rq_reqmsg);
body = lustre_swab_reqbuf(req, REQ_REC_OFF, sizeof(*body),
lustre_swab_ost_body);
if (desc == NULL)
GOTO(out, rc = -ENOMEM);
- rc = ost_brw_lock_get(LCK_PW, req->rq_export, ioo, pp_rnb, &lockh);
+ rc = ost_brw_lock_get(LCK_PW, exp, ioo, pp_rnb, &lockh);
if (rc != 0)
GOTO(out_bulk, rc);
GOTO(out_lock, rc = -ETIMEDOUT);
}
- ost_prolong_locks(req->rq_export, ioo, pp_rnb, LCK_PW);
+ ost_prolong_locks(exp, ioo, pp_rnb, LCK_PW);
/* obd_preprw clobbers oa->valid, so save what we need */
client_cksum = body->oa.o_valid & OBD_MD_FLCKSUM ? body->oa.o_cksum : 0;
body->oa.o_valid &= ~OBD_MD_FLGRANT;
}
- rc = obd_preprw(OBD_BRW_WRITE, req->rq_export, &body->oa, objcount,
+ rc = obd_preprw(OBD_BRW_WRITE, exp, &body->oa, objcount,
ioo, npages, pp_rnb, local_nb, oti, capa);
if (rc != 0)
GOTO(out_lock, rc);
sptlrpc_svc_unwrap_bulk(req, desc);
+ /* Check if there is eviction in progress, and if so, wait for
+ * it to finish */
+ if (unlikely(atomic_read(&exp->exp_obd->obd_evict_inprogress))) {
+ lwi = LWI_INTR(NULL, NULL);
+ rc = l_wait_event(exp->exp_obd->obd_evict_inprogress_waitq,
+ !atomic_read(&exp->exp_obd->obd_evict_inprogress),
+ &lwi);
+ }
+ if (rc == 0 && exp->exp_failed)
+ rc = -ENOTCONN;
+
/* Must commit after prep above in all cases */
- rc = obd_commitrw(OBD_BRW_WRITE, req->rq_export, &repbody->oa,
+ rc = obd_commitrw(OBD_BRW_WRITE, exp, &repbody->oa,
objcount, ioo, npages, local_nb, oti, rc);
if (unlikely(client_cksum != server_cksum && rc == 0)) {
LCONSOLE_ERROR_MSG(0x168, "%s: BAD WRITE CHECKSUM: %s from "
"%s%s%s inum "LPU64"/"LPU64" object "
LPU64"/"LPU64" extent ["LPU64"-"LPU64"]\n",
- req->rq_export->exp_obd->obd_name, msg,
+ exp->exp_obd->obd_name, msg,
libcfs_id2str(req->rq_peer),
via, router,
body->oa.o_valid & OBD_MD_FLFID ?
}
CWARN("%s: ignoring bulk IO comm error with %s@%s id %s - "
"client will retry\n",
- req->rq_export->exp_obd->obd_name,
- req->rq_export->exp_client_uuid.uuid,
- req->rq_export->exp_connection->c_remote_uuid.uuid,
+ exp->exp_obd->obd_name,
+ exp->exp_client_uuid.uuid,
+ exp->exp_connection->c_remote_uuid.uuid,
libcfs_id2str(req->rq_peer));
}
RETURN(rc);