RETURN(result);
}
-void mdt_pack_attr2body(struct mdt_body *b,
- struct lu_attr *attr,
+void mdt_pack_attr2body(struct mdt_body *b, const struct lu_attr *attr,
const struct lu_fid *fid)
{
b->valid |= OBD_MD_FLCTIME | OBD_MD_FLUID |
int mdt_reint_unpack(struct mdt_thread_info *info, __u32 op);
int mdt_reint_rec(struct mdt_thread_info *);
-void mdt_pack_attr2body(struct mdt_body *b, struct lu_attr *attr,
+void mdt_pack_attr2body(struct mdt_body *b, const struct lu_attr *attr,
const struct lu_fid *fid);
int mdt_getxattr(struct mdt_thread_info *info);
int mdt_done_writing(struct mdt_thread_info *info);
void mdt_shrink_reply(struct mdt_thread_info *info);
-int mdt_handle_last_unlink(struct mdt_thread_info *, struct mdt_object *);
+int mdt_handle_last_unlink(struct mdt_thread_info *, struct mdt_object *,
+ const struct md_attr *);
void mdt_dump_lmm(int level, struct lov_mds_md *lmm);
if (body && body->valid & OBD_MD_FLCOOKIE) {
LASSERT(body->valid & OBD_MD_FLEASIZE);
lmm = req_capsule_server_get(&info->mti_pill, &RMF_MDT_MD);
- cookie_size = le32_to_cpu(lmm->lmm_stripe_count) *
+ cookie_size = le32_to_cpu(lmm->lmm_stripe_count) *
sizeof(struct llog_cookie);
}
- CDEBUG(D_INFO, "Shrink to md_size %d cookie_size %d \n",
+ CDEBUG(D_INFO, "Shrink to md_size %d cookie_size %d \n",
md_size, cookie_size);
lustre_shrink_reply(req, 1, md_size, 1);
/* if object is dying, pack the lov/llog data,
* parameter info->mti_attr should be valid at this point! */
-int mdt_handle_last_unlink(struct mdt_thread_info *info, struct mdt_object *mo)
+int mdt_handle_last_unlink(struct mdt_thread_info *info, struct mdt_object *mo,
+ const struct md_attr *ma)
{
- struct mdt_body *repbody;
- struct md_attr *ma = &info->mti_attr;
- struct lu_attr *la = &ma->ma_attr;
- int rc = 0;
+ struct mdt_body *repbody;
+ const struct lu_attr *la = &ma->ma_attr;
ENTRY;
PFID3(mdt_object_fid(mo)));
CDEBUG(D_INODE, "ma_valid = "LPX64"\n", ma->ma_valid);
- repbody = req_capsule_server_get(&info->mti_pill,
+ repbody = req_capsule_server_get(&info->mti_pill,
&RMF_MDT_BODY);
if (ma->ma_valid & MA_INODE)
mdt_pack_attr2body(repbody, la, mdt_object_fid(mo));
repbody->eadatasize = ma->ma_lmm_size;
repbody->valid |= OBD_MD_FLEASIZE;
}
-
- if (ma->ma_cookie_size && ma->ma_valid & MA_COOKIE)
+
+ if (ma->ma_cookie_size && ma->ma_valid & MA_COOKIE)
repbody->valid |= OBD_MD_FLCOOKIE;
}
- RETURN(rc);
+ RETURN(0);
}
/* unpacking */
{
int rc;
ENTRY;
-
+
rc = req_capsule_pack(&info->mti_pill);
if (rc)
RETURN(rc);
-
+
switch (info->mti_attr.ma_attr.la_mode & S_IFMT) {
case S_IFREG:
case S_IFDIR:{
DEBUG_REQ(D_INODE, req, "unlink "DFID3"/%s\n", PFID3(rr->rr_fid1),
rr->rr_name);
/*pack the reply*/
- req_capsule_set_size(&info->mti_pill, &RMF_MDT_MD, RCL_SERVER,
+ req_capsule_set_size(&info->mti_pill, &RMF_MDT_MD, RCL_SERVER,
info->mti_mdt->mdt_max_mdsize);
- req_capsule_set_size(&info->mti_pill, &RMF_LOGCOOKIES, RCL_SERVER,
+ req_capsule_set_size(&info->mti_pill, &RMF_LOGCOOKIES, RCL_SERVER,
info->mti_mdt->mdt_max_cookiesize);
rc = req_capsule_pack(&info->mti_pill);
if (rc)
/*step 3: do some checking ...*/
-
+
/* step 4: delete it */
/* cmm will take care if child is local or remote */
ma->ma_lmm_size = req_capsule_get_size(&info->mti_pill,
&RMF_MDT_MD, RCL_SERVER);
- ma->ma_cookie = req_capsule_server_get(&info->mti_pill,
+ ma->ma_cookie = req_capsule_server_get(&info->mti_pill,
&RMF_LOGCOOKIES);
ma->ma_cookie_size = req_capsule_get_size(&info->mti_pill,
&RMF_LOGCOOKIES, RCL_SERVER);
-
+
if (!ma->ma_lmm || !ma->ma_cookie)
GOTO(out_unlock_parent, rc = -EINVAL);
if (rc)
GOTO(out_unlock_child, rc);
- rc = mdt_handle_last_unlink(info, mc);
+ rc = mdt_handle_last_unlink(info, mc, ma);
GOTO(out_unlock_child, rc);
out_unlock_child:
if (rc == 0) {
/* the new_fid should have been filled at this moment*/
if (lu_fid_eq(old_fid, new_fid))
- GOTO(out_unlock_old, rc);
-
- if (lu_fid_eq(new_fid, rr->rr_fid1) ||
+ GOTO(out_unlock_old, rc);
+
+ if (lu_fid_eq(new_fid, rr->rr_fid1) ||
lu_fid_eq(new_fid, rr->rr_fid2))
GOTO(out_unlock_old, rc = -EINVAL);