GOTO(out, rc);
if (S_ISREG(mode))
- (void) mdt_get_som(info, o, &ma->ma_attr);
+ (void) mdt_get_som(info, o, ma);
ma->ma_valid |= MA_INODE;
}
GOTO(out, rc);
}
+ /*
+ * In the handle of MA_INODE, we may already get the SOM attr.
+ */
+ if (need & MA_SOM && S_ISREG(mode) && !(ma->ma_valid & MA_SOM)) {
+ rc = mdt_get_som(info, o, ma);
+ if (rc != 0)
+ GOTO(out, rc);
+ }
+
if (need & MA_HSM && S_ISREG(mode)) {
buf->lb_buf = info->mti_xattr_buf;
buf->lb_len = sizeof(info->mti_xattr_buf);
if (rc)
GOTO(out, rc);
+ mutex_lock(&obj->mot_som_mutex);
rc = mo_layout_change(info->mti_env, mdt_object_child(obj), layout);
-
+ mutex_unlock(&obj->mot_som_mutex);
mdt_object_unlock(info, obj, lh, 1);
out:
RETURN(rc);
lu_object_add_top(h, o);
o->lo_ops = &mdt_obj_ops;
spin_lock_init(&mo->mot_write_lock);
+ mutex_init(&mo->mot_som_mutex);
mutex_init(&mo->mot_lov_mutex);
init_rwsem(&mo->mot_dom_sem);
init_rwsem(&mo->mot_open_sem);