From: tappro Date: Wed, 23 Aug 2006 09:58:15 +0000 (+0000) Subject: update due to new close() handling, X-Git-Tag: v1_8_0_110~486^2~1115 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=5c683a97cbeeb292303d6f4f838a71ac5f32ab1b;p=fs%2Flustre-release.git update due to new close() handling, --- diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 854258d..30648b3 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -998,7 +998,12 @@ static struct mdt_handler *mdt_handler_find(__u32 opc, 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, @@ -1101,18 +1106,18 @@ static inline void mdt_finish_reply(struct mdt_thread_info *info, int rc) 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); } /* @@ -1280,7 +1285,8 @@ static int mdt_recovery(struct ptlrpc_request *req) /* 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, " @@ -1307,7 +1313,6 @@ static int mdt_recovery(struct ptlrpc_request *req) rc = mds_filter_recovery_request(req, obd, &should_process); if (rc != 0 || !should_process) { - //LASSERT(rc < 0); RETURN(rc); } } diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index 11b7fc1..7b88226 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -62,9 +62,29 @@ struct mdt_client_data { __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 { diff --git a/lustre/mdt/mdt_recovery.c b/lustre/mdt/mdt_recovery.c index 3feb844..0be6df9 100644 --- a/lustre/mdt/mdt_recovery.c +++ b/lustre/mdt/mdt_recovery.c @@ -149,7 +149,7 @@ static int mdt_init_clients_data(const struct lu_context *ctx, 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 @@ -158,7 +158,7 @@ static int mdt_init_clients_data(const struct lu_context *ctx, 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)) @@ -515,12 +515,20 @@ static int mdt_update_last_rcvd(struct mdt_thread_info *mti, 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;