}
static int mdt_raw_lookup(struct mdt_thread_info *info,
- struct mdt_object *parent,
- const struct lu_name *lname,
- struct ldlm_reply *ldlm_rep)
+ struct mdt_object *parent,
+ const struct lu_name *lname,
+ struct ldlm_reply *ldlm_rep)
{
- struct md_object *next = mdt_object_child(info->mti_object);
- const struct mdt_body *reqbody = info->mti_body;
- struct lu_fid *child_fid = &info->mti_tmp_fid1;
- struct mdt_body *repbody;
- int rc;
- ENTRY;
-
- if (reqbody->mbo_valid != OBD_MD_FLID)
- RETURN(0);
+ struct lu_fid *child_fid = &info->mti_tmp_fid1;
+ int rc;
+ ENTRY;
- LASSERT(!info->mti_cross_ref);
+ LASSERT(!info->mti_cross_ref);
- /* Only got the fid of this obj by name */
- fid_zero(child_fid);
- rc = mdo_lookup(info->mti_env, next, lname, child_fid,
- &info->mti_spec);
-#if 0
- /* XXX is raw_lookup possible as intent operation? */
- if (rc != 0) {
- if (rc == -ENOENT)
- mdt_set_disposition(info, ldlm_rep, DISP_LOOKUP_NEG);
- RETURN(rc);
- } else
- mdt_set_disposition(info, ldlm_rep, DISP_LOOKUP_POS);
+ /* Only got the fid of this obj by name */
+ fid_zero(child_fid);
+ rc = mdo_lookup(info->mti_env, mdt_object_child(info->mti_object),
+ lname, child_fid, &info->mti_spec);
+ if (rc == 0) {
+ struct mdt_body *repbody;
- repbody = req_capsule_server_get(info->mti_pill, &RMF_MDT_BODY);
-#endif
- if (rc == 0) {
- repbody = req_capsule_server_get(info->mti_pill, &RMF_MDT_BODY);
+ repbody = req_capsule_server_get(info->mti_pill, &RMF_MDT_BODY);
repbody->mbo_fid1 = *child_fid;
repbody->mbo_valid = OBD_MD_FLID;
- }
- RETURN(1);
+ mdt_set_disposition(info, ldlm_rep, DISP_LOOKUP_POS);
+ } else if (rc == -ENOENT) {
+ mdt_set_disposition(info, ldlm_rep, DISP_LOOKUP_NEG);
+ }
+
+ RETURN(rc);
}
/*
}
if (lu_name_is_valid(lname)) {
- rc = mdt_raw_lookup(info, parent, lname, ldlm_rep);
- if (rc != 0) {
- if (rc > 0)
- rc = 0;
+ /* Always allow to lookup ".." */
+ if (unlikely(lname->ln_namelen == 2 &&
+ lname->ln_name[0] == '.' &&
+ lname->ln_name[1] == '.'))
+ info->mti_spec.sp_permitted = 1;
+
+ if (info->mti_body->mbo_valid == OBD_MD_FLID) {
+ rc = mdt_raw_lookup(info, parent, lname, ldlm_rep);
+
RETURN(rc);
}
info->mti_spec.no_create = 0;
info->mti_spec.sp_rm_entry = 0;
+ info->mti_spec.sp_permitted = 0;
info->mti_spec.u.sp_ea.eadata = NULL;
info->mti_spec.u.sp_ea.eadatalen = 0;