void req_capsule_set(struct req_capsule *pill, const struct req_format *fmt);
int req_capsule_pack(struct req_capsule *pill);
-void *req_capsule_client_get(const struct req_capsule *pill,
+void *req_capsule_client_get(struct req_capsule *pill,
const struct req_msg_field *field);
-void *req_capsule_server_get(const struct req_capsule *pill,
+void *req_capsule_server_get(struct req_capsule *pill,
const struct req_msg_field *field);
-const void *req_capsule_other_get(const struct req_capsule *pill,
+const void *req_capsule_other_get(struct req_capsule *pill,
const struct req_msg_field *field);
void req_capsule_set_size(const struct req_capsule *pill,
const struct mdt_body *body;
struct mdt_object *obj;
const struct lu_context *ctx;
- const struct req_capsule *pill;
+ struct req_capsule *pill;
ctx = info->mti_ctxt;
pill = &info->mti_pill;
int flags)
{
long opc;
+ int rc;
struct ldlm_reply *rep;
static const struct req_format *intent_fmts[REINT_MAX] = {
RETURN(-EPROTO);
}
- opc = req_capsule_pack(&info->mti_pill);
- if (opc)
- RETURN(opc);
+ rc = req_capsule_pack(&info->mti_pill);
+ if (rc)
+ RETURN(rc);
rep = req_capsule_server_get(&info->mti_pill, &RMF_DLM_REP);
if (rep == NULL)
struct lov_mds_md *lmm = info->mti_reint_rep.mrr_md;
struct mdt_reint_record *rr = &info->mti_rr;
int created = 0;
- struct lu_fid child_fid;
+ struct lu_fid child_fid;
ENTRY;
lh = &info->mti_lh[MDT_LH_PARENT];
lh->mlh_mode = LCK_PW;
- req_capsule_pack(&info->mti_pill);
+ //req_capsule_pack(&info->mti_pill);
ldlm_rep = req_capsule_server_get(&info->mti_pill, &RMF_DLM_REP);
+ body = req_capsule_server_get(&info->mti_pill, &RMF_MDT_BODY);
parent = mdt_object_find_lock(info->mti_ctxt, mdt, rr->rr_fid1,
lh, MDS_INODELOCK_UPDATE);
intent_set_disposition(ldlm_rep, DISP_LOOKUP_EXECD);
- if (result == -ENOENT)
- intent_set_disposition(ldlm_rep, DISP_LOOKUP_NEG);
- else
- intent_set_disposition(ldlm_rep, DISP_LOOKUP_POS);
-
if (result == -ENOENT) {
- if(!(info->mti_attr.la_flags & MDS_OPEN_CREAT))
+ intent_set_disposition(ldlm_rep, DISP_LOOKUP_NEG);
+ if (!(info->mti_attr.la_flags & MDS_OPEN_CREAT))
GOTO(out_parent, result);
if (req->rq_export->exp_connect_flags & OBD_CONNECT_RDONLY)
GOTO(out_parent, result = -EROFS);
- }
+ child_fid = *info->mti_rr.rr_fid2;
+ } else {
+ intent_set_disposition(ldlm_rep, DISP_LOOKUP_POS);
+ if (info->mti_attr.la_flags & MDS_OPEN_EXCL &&
+ info->mti_attr.la_flags & MDS_OPEN_CREAT)
+ GOTO(out_parent, result = -EEXIST);
+ }
child = mdt_object_find(info->mti_ctxt, mdt, &child_fid);
if (IS_ERR(child))
GOTO(out_parent, result = PTR_ERR(child));
if (result != 0)
GOTO(out_child, result);
created = 1;
- } else if (info->mti_attr.la_flags & MDS_OPEN_EXCL &&
- info->mti_attr.la_flags & MDS_OPEN_CREAT) {
- GOTO(out_child, result = -EEXIST);
+ } else {
+ result = mo_attr_get(info->mti_ctxt,
+ mdt_object_child(child),
+ &info->mti_attr);
+ if (result != 0)
+ GOTO(destroy_child, result);
}
- result = mo_attr_get(info->mti_ctxt,
- mdt_object_child(child),
- &info->mti_attr);
- if (result != 0)
- GOTO(destroy_child, result);
-
mdt_pack_attr2body(body, &info->mti_attr);
body->fid1 = *mdt_object_fid(child);
body->valid |= OBD_MD_FLID;
return offset;
}
-static void *__req_capsule_get(const struct req_capsule *pill,
+static void *__req_capsule_get(struct req_capsule *pill,
const struct req_msg_field *field,
enum req_location loc)
{
if (!(pill->rc_swabbed & (1 << offset)) && loc != pill->rc_loc &&
field->rmf_swabber != NULL && value != NULL &&
- lustre_msg_swabbed(msg))
+ lustre_msg_swabbed(msg)) {
field->rmf_swabber(value);
+ pill->rc_swabbed |= (1 << offset);
+ }
if (value == NULL)
DEBUG_REQ(D_ERROR, pill->rc_req,
"Wrong buffer for field `%s' (%d of %d) "
return value;
}
-void *req_capsule_client_get(const struct req_capsule *pill,
+void *req_capsule_client_get(struct req_capsule *pill,
const struct req_msg_field *field)
{
return __req_capsule_get(pill, field, RCL_CLIENT);
}
EXPORT_SYMBOL(req_capsule_client_get);
-void *req_capsule_server_get(const struct req_capsule *pill,
+void *req_capsule_server_get(struct req_capsule *pill,
const struct req_msg_field *field)
{
return __req_capsule_get(pill, field, RCL_SERVER);
}
EXPORT_SYMBOL(req_capsule_server_get);
-const void *req_capsule_other_get(const struct req_capsule *pill,
+const void *req_capsule_other_get(struct req_capsule *pill,
const struct req_msg_field *field)
{
return __req_capsule_get(pill, field, pill->rc_loc ^ 1);
LASSERT(FMT_FIELD(fmt, i, j)->rmf_size >=
FMT_FIELD(old, i, j)->rmf_size);
}
+ /* last field should be returned to the unswabbed state */
+ pill->rc_swabbed &= ~(__u32)(1 << j);
pill->rc_fmt = fmt;
}
EXPORT_SYMBOL(req_capsule_extend);