if (rc)
GOTO(out_unlock, rc);
- rc = __mdd_index_insert_only(env, mdd_tobj, mdo2fid(mdd_sobj),
- name, handle,
- mdd_object_capa(env, mdd_tobj));
- if (rc)
- GOTO(out_unlock, rc);
-
rc = mdo_ref_add(env, mdd_sobj, handle);
+ if (rc)
+ GOTO(out_unlock, rc);
+
+
+ rc = __mdd_index_insert_only(env, mdd_tobj, mdo2fid(mdd_sobj),
+ name, handle,
+ mdd_object_capa(env, mdd_tobj));
if (rc != 0) {
- __mdd_index_delete_only(env, mdd_tobj, name, handle,
- mdd_object_capa(env, mdd_tobj));
- GOTO(out_unlock, rc);
+ mdo_ref_del(env, mdd_sobj, handle);
+ GOTO(out_unlock, rc);
}
LASSERT(ma->ma_attr.la_valid & LA_CTIME);
if (rc)
GOTO(cleanup, rc);
+ rc = __mdd_index_delete(env, mdd_pobj, name, is_dir, handle,
+ mdd_object_capa(env, mdd_pobj));
+ if (rc)
+ GOTO(cleanup, rc);
+
rc = mdo_ref_del(env, mdd_cobj, handle);
if (rc != 0) {
__mdd_index_insert_only(env, mdd_pobj, mdo2fid(mdd_cobj),
GOTO(cleanup, rc);
}
- rc = __mdd_index_delete(env, mdd_pobj, name, is_dir, handle,
- mdd_object_capa(env, mdd_pobj));
- if (rc)
- GOTO(cleanup, rc);
-
if (is_dir)
/* unlink dot */
mdo_ref_del(env, mdd_cobj, handle);
spec->u.sp_ea.eadata, spec->u.sp_ea.eadatalen,
spec->sp_cr_flags, spec->no_create);
- if (spec->no_create) {
- /* replay case */
+ if (spec->no_create || spec->sp_cr_flags & MDS_OPEN_HAS_EA) {
+ /* replay case or lfs setstripe */
buf = mdd_buf_get_const(env, spec->u.sp_ea.eadata,
spec->u.sp_ea.eadatalen);
- } else if (!(spec->sp_cr_flags & MDS_OPEN_HAS_OBJS)) {
- if (spec->sp_cr_flags & MDS_OPEN_HAS_EA) {
- /* lfs setstripe */
- buf = mdd_buf_get_const(env, spec->u.sp_ea.eadata,
- spec->u.sp_ea.eadatalen);
- } else {
- buf = &LU_BUF_NULL;
- }
} else {
- /* MDS_OPEN_HAS_OBJS is not used anymore ? */
- LBUG();
+ buf = &LU_BUF_NULL;
}
rc = dt_declare_xattr_set(env, mdd_object_child(son), buf,
{
int rc;
+ /*
+ * inode mode has been set in creation time, and it's based on umask,
+ * la_mode and acl, don't set here again! (which will go wrong
+ * because below function doesn't consider umask).
+ * I'd suggest set all object attributes in creation time, see above.
+ */
+ LASSERT(attr->la_valid & (LA_MODE | LA_TYPE));
+ attr->la_valid &= ~(LA_MODE | LA_TYPE);
rc = mdo_declare_attr_set(env, child, attr, handle);
+ attr->la_valid |= LA_MODE | LA_TYPE;
if (rc == 0 && S_ISDIR(attr->la_mode)) {
rc = mdo_declare_index_insert(env, child, mdo2fid(child),
dot, handle);
* because below function doesn't consider umask).
* I'd suggest set all object attributes in creation time, see above.
*/
- LASSERT(attr->la_valid & LA_MODE);
- attr->la_valid &= ~LA_MODE;
+ LASSERT(attr->la_valid & (LA_MODE | LA_TYPE));
+ attr->la_valid &= ~(LA_MODE | LA_TYPE);
rc = mdd_attr_set_internal(env, child, attr, handle, 0);
/* arguments are supposed to stay the same */
- attr->la_valid |= LA_MODE;
+ attr->la_valid |= LA_MODE | LA_TYPE;
if (rc != 0)
RETURN(rc);
struct lu_fid *fid = &info->mti_fid;
struct mdd_object *obj = md2mdd_obj(pobj);
struct mdd_device *m = mdo2mdd(pobj);
- int lookup = spec->sp_cr_lookup;
int rc;
ENTRY;
if (mdd_is_dead_obj(obj))
RETURN(-ENOENT);
- /*
+ /*
* In some cases this lookup is not needed - we know before if name
* exists or not because MDT performs lookup for it.
* name length check is done in lookup.
*/
- if (lookup) {
+ if (spec->sp_cr_lookup) {
/*
* Check if the name already exist, though it will be checked in
* _index_insert also, for avoiding rolling back if exists