That is: check the existance of parent directory.
struct dt_object *obj;
struct dt_it_ops *iops;
int result;
+ ENTRY;
obj = mdd_object_child(dir);
iops = &obj->do_index_ops->dio_it;
iops->fini(env, it);
} else
result = -ENOMEM;
- return result;
+ RETURN(result);
}
/* return md_attr back,
if (mdd_is_dead_obj(mdd_obj))
RETURN(-ESTALE);
+ rc = lu_object_exists(mdd2lu_obj(mdd_obj));
+ if (rc == 0)
+ RETURN(-ESTALE);
+ else if (rc < 0) {
+ CERROR("Object "DFID" locates on remote server\n",
+ PFID(mdo2fid(mdd_obj)));
+ LBUG();
+ }
+
if (mask == MAY_EXEC)
rc = mdd_exec_permission_lite(env, mdd_obj);
else
GOTO(out, rc);
}
+ rc = mdt_object_exists(parent);
+ if (rc == 0)
+ RETURN(-ESTALE);
+ else if (rc < 0) {
+ CERROR("Object "DFID" locates on remote server\n",
+ PFID(mdt_object_fid(parent)));
+ LBUG();
+ }
+
/*step 1: lock parent */
lhp = &info->mti_lh[MDT_LH_PARENT];
lhp->mlh_mode = LCK_CR;
LASSERT(!lustre_handle_is_used(&lh->mlh_lh));
LASSERT(lh->mlh_mode != LCK_MINMODE);
- if (lu_object_exists(&o->mot_obj.mo_lu) < 0) {
+ if (mdt_object_exists(o) < 0) {
LASSERT(!(ibits & MDS_INODELOCK_UPDATE));
LASSERT(ibits & MDS_INODELOCK_LOOKUP);
}
int mdt_object_cr_lock(struct mdt_thread_info *info, struct mdt_object *o,
struct mdt_lock_handle *lh, __u64 ibits)
{
- if (lu_object_exists(&o->mot_obj.mo_lu) < 0) {
+ if (mdt_object_exists(o) < 0) {
/* cross-ref object fix */
ibits &= ~MDS_INODELOCK_UPDATE;
ibits |= MDS_INODELOCK_LOOKUP;
obj = mdt_object_find(env, info->mti_mdt, &body->fid1);
if (!IS_ERR(obj)) {
if ((flags & HABEO_CORPUS) &&
- !lu_object_exists(&obj->mot_obj.mo_lu)) {
+ !mdt_object_exists(obj)) {
mdt_object_put(env, obj);
rc = -ENOENT;
} else {
EXIT;
}
+static inline int mdt_object_exists(const struct mdt_object *o)
+{
+ return lu_object_exists(&o->mot_obj.mo_lu);
+}
+
static inline const struct lu_fid *mdt_object_fid(struct mdt_object *o)
{
return lu_object_fid(&o->mot_obj.mo_lu);
if (ma->ma_valid & MA_LOV) {
__u32 mode;
- if (lu_object_exists(&mo->mot_obj.mo_lu) < 0)
+ if (mdt_object_exists(mo) < 0)
/* If it is a remote object, and we do not retrieve
* EA back unlink reg file*/
mode = S_IFREG;
child = mdt_object_find(env, mdt, rr->rr_fid2);
LASSERT(!IS_ERR(child));
- rc = lu_object_exists(&child->mot_obj.mo_lu);
+ rc = mdt_object_exists(child);
if (rc > 0) {
struct md_object *next;
next = mdt_object_child(child);
if (IS_ERR(o))
RETURN(rc = PTR_ERR(o));
- rc = lu_object_exists(&o->mot_obj.mo_lu);
+ rc = mdt_object_exists(o);
if (rc > 0) {
const struct lu_env *env = info->mti_env;
if (IS_ERR(o))
RETURN(rc = PTR_ERR(o));
- rc = lu_object_exists(&o->mot_obj.mo_lu);
+ rc = mdt_object_exists(o);
if (rc > 0) {
mdt_set_capainfo(info, 0, fid, BYPASS_CAPA);
rc = mo_attr_get(info->mti_env, mdt_object_child(o), ma);
if (IS_ERR(parent))
GOTO(out, result = PTR_ERR(parent));
+ result = mdt_object_exists(parent);
+ if (result == 0)
+ GOTO(out_parent, result = -ESTALE);
+ else if (result < 0) {
+ CERROR("Object "DFID" locates on remote server\n",
+ PFID(mdt_object_fid(parent)));
+ LBUG();
+ }
+
result = mdo_lookup(info->mti_env, mdt_object_child(parent),
rr->rr_name, child_fid);
if (result != 0 && result != -ENOENT && result != -ESTALE)
if (IS_ERR(parent))
RETURN(PTR_ERR(parent));
+ rc = mdt_object_exists(parent);
+ if (rc == 0)
+ GOTO(out, rc = -ESTALE);
+ else if (rc < 0) {
+ CERROR("Object "DFID" locates on remote server\n",
+ PFID(mdt_object_fid(parent)));
+ LBUG();
+ }
+
child = mdt_object_find(info->mti_env, mdt, rr->rr_fid2);
if (!IS_ERR(child)) {
struct md_object *next = mdt_object_child(parent);
mdt_object_put(info->mti_env, child);
} else
rc = PTR_ERR(child);
+out:
mdt_object_unlock_put(info, parent, lh, rc);
RETURN(rc);
}
ma->ma_need = MA_INODE;
/* Cross-ref create can encounter already created obj in case
* of recovery, just get attr in that case */
- if (lu_object_exists(&o->mot_obj.mo_lu) == 1) {
+ if (mdt_object_exists(o) == 1) {
rc = mo_attr_get(info->mti_env, next, ma);
} else {
rc = mo_object_create(info->mti_env, next,
if (IS_ERR(mp))
GOTO(out, rc = PTR_ERR(mp));
+ rc = mdt_object_exists(mp);
+ if (rc == 0)
+ GOTO(out_unlock_parent, rc = -ESTALE);
+ else if (rc < 0) {
+ CERROR("Object "DFID" locates on remote server\n",
+ PFID(mdt_object_fid(mp)));
+ LBUG();
+ }
+
ma->ma_lmm = req_capsule_server_get(&info->mti_pill, &RMF_MDT_MD);
ma->ma_lmm_size = req_capsule_get_size(&info->mti_pill,
&RMF_MDT_MD, RCL_SERVER);
* Therefore the object absense is allowed case
* and nothing should be done
*/
- if (lu_object_exists(&mp->mot_obj.mo_lu) > 0) {
+ if (mdt_object_exists(mp) > 0) {
rc = mo_ref_del(info->mti_env,
mdt_object_child(mp), ma);
mdt_handle_last_unlink(info, mp, ma);
[ `$GETSTRIPE $DIR/d27/f27m_$i | grep -A 10 obdidx | awk '{print $1}'| grep -w "0"` ] && \
error "OST0 was full but new created file still use it"
rm -r $DIR/d27
+ sleep 15
}
run_test 27m "create file while OST0 was full =================="