struct obd_export *exp = req->rq_export;
CERROR("%s: replay trans "LPU64" NID %s: rc = %d\n",
- mdt->mdt_md_dev.md_lu_dev.ld_obd->obd_name,
- info->mti_transno,
- libcfs_nid2str(exp->exp_connection->c_peer.nid),
- rc);
+ mdt_obd_name(mdt), info->mti_transno,
+ libcfs_nid2str(exp->exp_connection->c_peer.nid),
+ rc);
RETURN_EXIT;
}
} else if (info->mti_transno == 0) {
}
spin_unlock(&mdt->mdt_lut.lut_translock);
- CDEBUG(D_INODE, "transno = "LPU64", last_committed = "LPU64"\n",
- info->mti_transno,
- req->rq_export->exp_obd->obd_last_committed);
+ CDEBUG(D_INODE, "transno = "LPU64", last_committed = "LPU64"\n",
+ info->mti_transno,
+ req->rq_export->exp_obd->obd_last_committed);
- req->rq_transno = info->mti_transno;
- lustre_msg_set_transno(req->rq_repmsg, info->mti_transno);
+ req->rq_transno = info->mti_transno;
+ lustre_msg_set_transno(req->rq_repmsg, info->mti_transno);
- /* update lcd in memory only for resent cases */
- ted = &req->rq_export->exp_target_data;
- LASSERT(ted);
+ /* update lcd in memory only for resent cases */
+ ted = &req->rq_export->exp_target_data;
+ LASSERT(ted);
mutex_lock(&ted->ted_lcd_lock);
- lcd = ted->ted_lcd;
+ lcd = ted->ted_lcd;
if (info->mti_transno < lcd->lcd_last_transno &&
info->mti_transno != 0) {
/* This should happen during replay. Do not update
* be checked correctly by xid */
mutex_unlock(&ted->ted_lcd_lock);
CDEBUG(D_HA, "%s: transno = "LPU64" < last_transno = "LPU64"\n",
- mdt->mdt_md_dev.md_lu_dev.ld_obd->obd_name,
- info->mti_transno, lcd->lcd_last_transno);
+ mdt_obd_name(mdt), info->mti_transno,
+ lcd->lcd_last_transno);
RETURN_EXIT;
}
* that looks like it was actually almost succesful and a failure at the
* same time */
if (OBD_FAIL_CHECK(OBD_FAIL_MDS_NEGATIVE_POSITIVE)) {
- mdt_set_disposition(info, rep, DISP_OPEN_LOCK | \
- DISP_OPEN_OPEN | DISP_LOOKUP_NEG | \
- DISP_LOOKUP_POS);
+ mdt_set_disposition(info, rep, DISP_OPEN_OPEN |
+ DISP_LOOKUP_NEG |
+ DISP_LOOKUP_POS);
+
+ if (flags & MDS_OPEN_LOCK)
+ mdt_set_disposition(info, rep, DISP_OPEN_LOCK);
+
RETURN(-ENOENT);
}
* if open or layout lock is granted. */
rc = 1;
}
- if (rc != 0)
+
+ if (rc != 0) {
+ struct ldlm_reply *ldlm_rep;
+
+ ldlm_rep = req_capsule_server_get(info->mti_pill, &RMF_DLM_REP);
+ mdt_clear_disposition(info, ldlm_rep, DISP_OPEN_LOCK);
mdt_object_unlock(info, obj, lhc, 1);
+ }
}
int mdt_open_by_fid_lock(struct mdt_thread_info *info, struct ldlm_reply *rep,
struct mdt_object *parent= NULL;
struct mdt_object *o;
int rc;
- __u64 ibits;
+ __u64 ibits = 0;
ENTRY;
if (md_should_create(flags) && !(flags & MDS_OPEN_HAS_EA)) {
if (mdt_object_remote(o)) {
CDEBUG(D_INFO, "%s: "DFID" is on remote MDT.\n",
- info->mti_mdt->mdt_md_dev.md_lu_dev.ld_obd->obd_name,
+ mdt_obd_name(info->mti_mdt),
PFID(rr->rr_fid2));
GOTO(out, rc = -EREMOTE);
} else if (!mdt_object_exists(o)) {
/* get openlock if this is not replay and if a client requested it */
if (!req_is_replay(req)) {
rc = mdt_object_open_lock(info, child, lhc, &ibits);
- if (rc != 0) {
+ if (rc != 0)
GOTO(out_child, result = rc);
- } else if (create_flags & MDS_OPEN_LOCK) {
- result = -EREMOTE;
+ else if (create_flags & MDS_OPEN_LOCK)
mdt_set_disposition(info, ldlm_rep, DISP_OPEN_LOCK);
- }
}
- /* Try to open it now. */
- rc = mdt_finish_open(info, parent, child, create_flags,
- created, ldlm_rep);
- if (rc) {
- result = rc;
+ /* Try to open it now. */
+ rc = mdt_finish_open(info, parent, child, create_flags,
+ created, ldlm_rep);
+ if (rc) {
+ result = rc;
/* openlock will be released if mdt_finish_open failed */
mdt_clear_disposition(info, ldlm_rep, DISP_OPEN_LOCK);
- if (created) {
- ma->ma_need = 0;
- ma->ma_valid = 0;
- ma->ma_cookie_size = 0;
- rc = mdo_unlink(info->mti_env,
- mdt_object_child(parent),
- mdt_object_child(child),
- lname,
- &info->mti_attr);
- if (rc != 0)
- CERROR("Error in cleanup of open\n");
+ if (created) {
+ ma->ma_need = 0;
+ ma->ma_valid = 0;
+ ma->ma_cookie_size = 0;
+ rc = mdo_unlink(info->mti_env,
+ mdt_object_child(parent),
+ mdt_object_child(child),
+ lname,
+ &info->mti_attr, 0);
+ if (rc != 0)
+ CERROR("%s: "DFID" cleanup of open: rc = %d\n",
+ mdt_obd_name(info->mti_mdt),
+ PFID(mdt_object_fid(child)), rc);
mdt_clear_disposition(info, ldlm_rep, DISP_OPEN_CREATE);
- }
- }
+ }
+ }
EXIT;
out_child:
mdt_object_open_unlock(info, child, lhc, ibits, result);
out_parent:
mdt_object_unlock_put(info, parent, lh, result || !created);
out:
- if (result && result != -EREMOTE)
- lustre_msg_set_transno(req->rq_repmsg, 0);
- return result;
+ if (result)
+ lustre_msg_set_transno(req->rq_repmsg, 0);
+ return result;
}
#define MFD_CLOSED(mode) (((mode) & ~(MDS_FMODE_EPOCH | MDS_FMODE_SOM | \