struct osc_async_rc loi_ar;
};
+void lov_fix_ea_for_replay(void *lovea);
+
static inline void loi_kms_set(struct lov_oinfo *oinfo, __u64 kms)
{
oinfo->loi_kms = kms;
return -1;
}
+
+/**
+ * lmm_layout_gen overlaps stripe_offset field, it needs to be reset back when
+ * sending to MDT for passing striping checks
+ */
+void lov_fix_ea_for_replay(void *lovea)
+{
+ struct lov_user_md *lmm = lovea;
+ struct lov_comp_md_v1 *c1;
+ int i;
+
+ switch (le32_to_cpu(lmm->lmm_magic)) {
+ case LOV_USER_MAGIC_V1:
+ case LOV_USER_MAGIC_V3:
+ lmm->lmm_stripe_offset = LOV_OFFSET_DEFAULT;
+ break;
+
+ case LOV_USER_MAGIC_COMP_V1:
+ c1 = (void *)lmm;
+ for (i = 0; i < le16_to_cpu(c1->lcm_entry_count); i++) {
+ struct lov_comp_md_entry_v1 *ent = &c1->lcm_entries[i];
+
+ if (le32_to_cpu(ent->lcme_flags) & LCME_FL_INIT) {
+ lmm = (void *)((char *)c1 +
+ le32_to_cpu(ent->lcme_offset));
+ lmm->lmm_stripe_offset = LOV_OFFSET_DEFAULT;
+ }
+ }
+ }
+}
+EXPORT_SYMBOL(lov_fix_ea_for_replay);
int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid,
struct list_head *cancels, enum ldlm_mode mode,
__u64 bits);
-int mdc_save_lovea(struct ptlrpc_request *req,
- const struct req_msg_field *field,
- void *data, u32 size);
/* mdc/mdc_request.c */
int mdc_fid_alloc(const struct lu_env *env, struct obd_export *exp,
struct lu_fid *fid, struct md_op_data *op_data);
}
}
-/* Save a large LOV EA into the request buffer so that it is available
+/**
+ * Save a large LOV EA into the request buffer so that it is available
* for replay. We don't do this in the initial request because the
* original request doesn't need this buffer (at most it sends just the
* lov_mds_md) and it is a waste of RAM/bandwidth to send the empty
* but this is incredibly unlikely, and questionable whether the client
* could do MDS recovery under OOM anyways...
*/
-int mdc_save_lovea(struct ptlrpc_request *req,
- const struct req_msg_field *field, void *data, u32 size)
+static int mdc_save_lovea(struct ptlrpc_request *req, void *data, u32 size)
{
struct req_capsule *pill = &req->rq_pill;
- struct lov_user_md *lmm;
+ void *lovea;
int rc = 0;
- if (req_capsule_get_size(pill, field, RCL_CLIENT) < size) {
- rc = sptlrpc_cli_enlarge_reqbuf(req, field, size);
+ if (req_capsule_get_size(pill, &RMF_EADATA, RCL_CLIENT) < size) {
+ rc = sptlrpc_cli_enlarge_reqbuf(req, &RMF_EADATA, size);
if (rc) {
CERROR("%s: Can't enlarge ea size to %d: rc = %d\n",
req->rq_export->exp_obd->obd_name,
return rc;
}
} else {
- req_capsule_shrink(pill, field, size, RCL_CLIENT);
+ req_capsule_shrink(pill, &RMF_EADATA, size, RCL_CLIENT);
}
- req_capsule_set_size(pill, field, RCL_CLIENT, size);
- lmm = req_capsule_client_get(pill, field);
- if (lmm) {
- memcpy(lmm, data, size);
- /* overwrite layout generation returned from the MDS */
- lmm->lmm_stripe_offset =
- (typeof(lmm->lmm_stripe_offset))LOV_OFFSET_DEFAULT;
+ req_capsule_set_size(pill, &RMF_EADATA, RCL_CLIENT, size);
+ lovea = req_capsule_client_get(pill, &RMF_EADATA);
+ if (lovea) {
+ memcpy(lovea, data, size);
+ lov_fix_ea_for_replay(lovea);
}
return rc;
* (for example error one).
*/
if ((it->it_op & IT_OPEN) && req->rq_replay) {
- rc = mdc_save_lovea(req, &RMF_EADATA, eadata,
+ rc = mdc_save_lovea(req, eadata,
body->mbo_eadatasize);
if (rc) {
body->mbo_valid &= ~OBD_MD_FLEASIZE;
* another set of OST objects).
*/
if (req->rq_transno)
- (void)mdc_save_lovea(req, &RMF_EADATA, lvb_data,
- lvb_len);
+ (void)mdc_save_lovea(req, lvb_data, lvb_len);
}
}
struct obd_client_handle *och;
struct lustre_handle old_open_handle = { };
struct mdt_body *body;
+ struct ldlm_reply *rep;
ENTRY;
if (mod == NULL) {
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
LASSERT(body != NULL);
+ rep = req_capsule_server_get(&req->rq_pill, &RMF_DLM_REP);
+ if (rep != NULL && rep->lock_policy_res2 != 0)
+ DEBUG_REQ(D_ERROR, req, "Open request replay failed with %ld ",
+ (long int)rep->lock_policy_res2);
+
spin_lock(&req->rq_lock);
och = mod->mod_och;
if (och && och->och_open_handle.cookie)
struct ldlm_reply *rep = NULL;
long opc;
int rc;
+ struct ptlrpc_request *req = mdt_info_req(info);
static const struct req_format *intent_fmts[REINT_MAX] = {
[REINT_CREATE] = &RQF_LDLM_INTENT_CREATE,
rc = mdt_reint_internal(info, lhc, opc);
+ if (rc < 0 && lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY)
+ DEBUG_REQ(D_ERROR, req, "Replay open failed with %d", rc);
+
/* Check whether the reply has been packed successfully. */
if (mdt_info_req(info)->rq_repmsg != NULL)
rep = req_capsule_server_get(info->mti_pill, &RMF_DLM_REP);
pool_add pool_134
pool_add_targets pool_134 1 1
- mkdir $DIR/$tdir
- $LFS setstripe -p pool_134 $DIR/$tdir
+ mkdir -p $DIR/$tdir/{A,B}
+ $LFS setstripe -p pool_134 $DIR/$tdir/A
+ $LFS setstripe -E EOF -p pool_134 $DIR/$tdir/B
replay_barrier mds1
- touch $DIR/$tdir/$tfile
+ touch $DIR/$tdir/A/$tfile || error "touch non-pfl file failed"
+ touch $DIR/$tdir/B/$tfile || error "touch pfl failed"
fail mds1
- [ -f $DIR/$tdir/$tfile ] || error "file does not exist"
+ [ -f $DIR/$tdir/A/$tfile ] || error "non-pfl file does not exist"
+ [ -f $DIR/$tdir/B/$tfile ] || error "pfl file does not exist"
}
run_test 134 "replay creation of a file created in a pool"
load_module fid/fid
load_module lmv/lmv
load_module osc/osc
- load_module mdc/mdc
load_module lov/lov
+ load_module mdc/mdc
load_module mgc/mgc
load_module obdecho/obdecho
if ! client_only; then