static inline __u64 req_exp_last_xid(struct ptlrpc_request *req)
{
- return req->rq_export->exp_mdt_data.med_mcd->mcd_last_xid;
+ return le64_to_cpu(req->rq_export->exp_mdt_data.med_mcd->mcd_last_xid);
+}
+
+static inline __u64 req_exp_last_close_xid(struct ptlrpc_request *req)
+{
+ return le64_to_cpu(req->rq_export->exp_mdt_data.med_mcd->mcd_last_close_xid);
}
static int mdt_lock_resname_compat(struct mdt_device *m,
CERROR("Transno is not 0 while rc is %i!\n", rc);
}
- CDEBUG(D_INODE, "last_transno = %llu, last_committed = %llu\n",
- mdt->mdt_last_transno, exp->exp_obd->obd_last_committed);
+ CDEBUG(D_INODE, "transno = %llu, last_committed = %llu\n",
+ info->mti_transno, exp->exp_obd->obd_last_committed);
spin_lock(&mdt->mdt_transno_lock);
req->rq_transno = info->mti_transno;
lustre_msg_set_transno(req->rq_repmsg, info->mti_transno);
- lustre_msg_set_last_committed(req->rq_repmsg,
- exp->exp_obd->obd_last_committed);
+ target_committed_to_req(req);
spin_unlock(&mdt->mdt_transno_lock);
- lustre_msg_set_last_xid(req->rq_repmsg, req->rq_xid);
+ lustre_msg_set_last_xid(req->rq_repmsg, req_exp_last_xid(req));
+ //lustre_msg_set_last_xid(req->rq_repmsg, req->rq_xid);
}
/*
/* sanity check: if the xid matches, the request must be marked as a
* resent or replayed */
- LASSERTF(ergo(req->rq_xid == req_exp_last_xid(req),
+ LASSERTF(ergo(req->rq_xid == req_exp_last_xid(req) ||
+ req->rq_xid == req_exp_last_close_xid(req),
lustre_msg_get_flags(req->rq_reqmsg) &
(MSG_RESENT | MSG_REPLAY)),
"rq_xid "LPU64" matches last_xid, "
rc = mds_filter_recovery_request(req, obd, &should_process);
if (rc != 0 || !should_process) {
- //LASSERT(rc < 0);
RETURN(rc);
}
}
__u64 mcd_last_xid; /* xid for the last transaction */
__u32 mcd_last_result; /* result from last RPC */
__u32 mcd_last_data; /* per-op data (disposition for open &c.) */
- __u8 mcd_padding[LR_CLIENT_SIZE - 64];
+ /* for MDS_CLOSE requests */
+ __u64 mcd_last_close_transno; /* last completed transaction ID */
+ __u64 mcd_last_close_xid; /* xid for the last transaction */
+ __u32 mcd_last_close_result; /* result from last RPC */
+ __u8 mcd_padding[LR_CLIENT_SIZE - 84];
};
+static inline __u64 mcd_last_transno(struct mdt_client_data *mcd)
+{
+ return (le64_to_cpu(mcd->mcd_last_transno) >
+ le64_to_cpu(mcd->mcd_last_close_transno) ?
+ le64_to_cpu(mcd->mcd_last_transno) :
+ le64_to_cpu(mcd->mcd_last_close_transno));
+}
+
+static inline __u64 mcd_last_xid(struct mdt_client_data *mcd)
+{
+ return (le64_to_cpu(mcd->mcd_last_xid) >
+ le64_to_cpu(mcd->mcd_last_close_xid) ?
+ le64_to_cpu(mcd->mcd_last_xid) :
+ le64_to_cpu(mcd->mcd_last_close_xid));
+}
+
/* copied from lr_server_data.
* mds data stored at the head of last_rcvd file. In le32 order. */
struct mdt_server_data {
continue;
}
- last_transno = le64_to_cpu(mcd->mcd_last_transno);
+ last_transno = mcd_last_transno(mcd);
/* These exports are cleaned up by mdt_obd_disconnect(), so
* they need to be set up like real exports as
CDEBUG(D_HA, "RCVRNG CLIENT uuid: %s idx: %d lr: "LPU64
" srv lr: "LPU64" lx: "LPU64"\n", mcd->mcd_uuid, cl_idx,
last_transno, le64_to_cpu(msd->msd_last_transno),
- le64_to_cpu(mcd->mcd_last_xid));
+ mcd_last_xid(mcd));
exp = class_new_export(obd, (struct obd_uuid *)mcd->mcd_uuid);
if (IS_ERR(exp))
off = med->med_lr_off;
mutex_down(&med->med_mcd_lock);
- mcd->mcd_last_transno = cpu_to_le64(mti->mti_transno);
- mcd->mcd_last_xid = cpu_to_le64(req->rq_xid);
- mcd->mcd_last_result = cpu_to_le32(rc);
- /* XXX: how to pass op_data here? */
- //mcd->mcd_last_data = cpu_to_le32(op_data);
-
+ if(lustre_msg_get_opc(req->rq_reqmsg) == MDS_CLOSE) {
+ mcd->mcd_last_close_transno = cpu_to_le64(mti->mti_transno);
+ mcd->mcd_last_close_xid = cpu_to_le64(req->rq_xid);
+ mcd->mcd_last_close_result = cpu_to_le32(rc);
+ } else {
+ mcd->mcd_last_transno = cpu_to_le64(mti->mti_transno);
+ mcd->mcd_last_xid = cpu_to_le64(req->rq_xid);
+ mcd->mcd_last_result = cpu_to_le32(rc);
+ /*XXX: save intent_disposition in mdt_thread_info?
+ * also there is bug - intent_dispostion is __u64,
+ * see struct ldlm_reply->lock_policy_res1;
+ mcd->mcd_last_data = cpu_to_le32(op_data);
+ */
+ }
if (off <= 0) {
CERROR("client idx %d has offset %lld\n", med->med_lr_idx, off);
err = -EINVAL;