GOTO(cleanup, rc);
mdd_ref_del_internal(env, mdd_cobj, handle);
- *la_copy = ma->ma_attr;
if (is_dir) {
/* unlink dot */
mdd_ref_del_internal(env, mdd_cobj, handle);
- } else {
- la_copy->la_valid = LA_CTIME;
- rc = mdd_attr_set_internal(env, mdd_cobj, la_copy, handle, 0);
- if (rc)
- GOTO(cleanup, rc);
}
+ *la_copy = ma->ma_attr;
+ la_copy->la_valid = LA_CTIME;
+ rc = mdd_attr_set_internal(env, mdd_cobj, la_copy, handle, 0);
+ if (rc)
+ GOTO(cleanup, rc);
+
la_copy->la_valid = LA_CTIME | LA_MTIME;
rc = mdd_attr_set_internal_locked(env, mdd_pobj, la_copy, handle, 0);
if (rc)
const char *name, const struct lu_fid *fid,
int isdir)
{
+ struct lu_attr *la_copy = &mdd_env_info(env)->mti_la_for_fix;
struct mdd_object *mdd_obj = md2mdd_obj(pobj);
struct mdd_device *mdd = mdo2mdd(pobj);
struct thandle *handle;
rc = __mdd_index_insert(env, mdd_obj, fid, name, isdir, handle,
BYPASS_CAPA);
+ if (rc == 0) {
+ la_copy->la_ctime = la_copy->la_mtime = CURRENT_SECONDS;
+ la_copy->la_valid = LA_CTIME | LA_MTIME;
+ rc = mdd_attr_set_internal_locked(env, mdd_obj, la_copy, handle, 0);
+ }
EXIT;
out_unlock:
struct md_object *pobj,
const char *name, int is_dir)
{
+ struct lu_attr *la_copy = &mdd_env_info(env)->mti_la_for_fix;
struct mdd_device *mdd = mdo2mdd(pobj);
struct mdd_object *mdd_obj = md2mdd_obj(pobj);
struct thandle *handle;
rc = __mdd_index_delete(env, mdd_obj, name, is_dir, handle,
BYPASS_CAPA);
+ if (rc == 0) {
+ la_copy->la_ctime = la_copy->la_mtime = CURRENT_SECONDS;
+ la_copy->la_valid = LA_CTIME | LA_MTIME;
+ rc = mdd_attr_set_internal_locked(env, mdd_obj, la_copy, handle, 0);
+ }
out_unlock:
mdd_pdo_write_unlock(env, mdd_obj, dlh);
const struct lu_fid *lf, const char *name,
struct md_attr *ma)
{
+ struct lu_attr *la_copy = &mdd_env_info(env)->mti_la_for_fix;
struct mdd_device *mdd = mdo2mdd(pobj);
struct mdd_object *mdd_tpobj = md2mdd_obj(pobj);
struct mdd_object *mdd_tobj = md2mdd_obj(tobj);
if (rc)
GOTO(cleanup, rc);
- if (tobj && lu_object_exists(&tobj->mo_lu))
+ *la_copy = ma->ma_attr;
+ la_copy->la_valid = LA_CTIME | LA_MTIME;
+ rc = mdd_attr_set_internal_locked(env, mdd_tpobj, la_copy, handle, 0);
+ if (rc)
+ GOTO(cleanup, rc);
+
+ if (tobj && lu_object_exists(&tobj->mo_lu)) {
mdd_ref_del_internal(env, mdd_tobj, handle);
+ la_copy->la_valid = LA_CTIME;
+ rc = mdd_attr_set_internal(env, mdd_tobj, la_copy, handle, 0);
+ }
cleanup:
if (tobj)
mdd_write_unlock(env, mdd_tobj);
if (rc)
GOTO(cleanup, rc);
- mdd_sobj = mdd_object_find(env, mdd, lf);
*la_copy = ma->ma_attr;
- la_copy->la_valid = LA_CTIME;
+ mdd_sobj = mdd_object_find(env, mdd, lf);
if (mdd_sobj) {
+ la_copy->la_valid = LA_CTIME;
/*XXX: how to update ctime for remote sobj? */
rc = mdd_attr_set_internal_locked(env, mdd_sobj, la_copy,
handle, 1);
static int mdd_xattr_set(const struct lu_env *env, struct md_object *obj,
const struct lu_buf *buf, const char *name, int fl)
{
+ struct lu_attr *la_copy = &mdd_env_info(env)->mti_la_for_fix;
struct mdd_object *mdd_obj = md2mdd_obj(obj);
struct mdd_device *mdd = mdo2mdd(obj);
struct thandle *handle;
rc = mdd_xattr_set_txn(env, md2mdd_obj(obj), buf, name,
fl, handle);
-
+ if (rc == 0) {
+ la_copy->la_ctime = CURRENT_SECONDS;
+ la_copy->la_valid = LA_CTIME;
+ rc = mdd_attr_set_internal_locked(env, mdd_obj, la_copy, handle, 0);
+ }
mdd_trans_stop(env, mdd, rc, handle);
RETURN(rc);
int mdd_xattr_del(const struct lu_env *env, struct md_object *obj,
const char *name)
{
+ struct lu_attr *la_copy = &mdd_env_info(env)->mti_la_for_fix;
struct mdd_object *mdd_obj = md2mdd_obj(obj);
struct mdd_device *mdd = mdo2mdd(obj);
struct thandle *handle;
mdd_write_lock(env, mdd_obj);
rc = __mdd_xattr_del(env, mdd, md2mdd_obj(obj), name, handle);
+ if (rc == 0) {
+ la_copy->la_ctime = CURRENT_SECONDS;
+ la_copy->la_valid = LA_CTIME;
+ rc = mdd_attr_set_internal(env, mdd_obj, la_copy, handle, 0);
+ }
mdd_write_unlock(env, mdd_obj);
mdd_trans_stop(env, mdd, rc, handle);
static int mdd_ref_del(const struct lu_env *env, struct md_object *obj,
struct md_attr *ma)
{
+ struct lu_attr *la_copy = &mdd_env_info(env)->mti_la_for_fix;
struct mdd_object *mdd_obj = md2mdd_obj(obj);
struct mdd_device *mdd = mdo2mdd(obj);
struct thandle *handle;
mdd_ref_del_internal(env, mdd_obj, handle);
}
+ la_copy->la_ctime = CURRENT_SECONDS;
+ la_copy->la_valid = LA_CTIME;
+ rc = mdd_attr_set_internal(env, mdd_obj, la_copy, handle, 0);
+ if (rc)
+ GOTO(cleanup, rc);
+
rc = mdd_finish_unlink(env, mdd_obj, ma, handle);
EXIT;
static int mdd_ref_add(const struct lu_env *env,
struct md_object *obj)
{
+ struct lu_attr *la_copy = &mdd_env_info(env)->mti_la_for_fix;
struct mdd_object *mdd_obj = md2mdd_obj(obj);
struct mdd_device *mdd = mdo2mdd(obj);
struct thandle *handle;
mdd_write_lock(env, mdd_obj);
rc = mdd_link_sanity_check(env, NULL, mdd_obj);
- if (rc == 0)
+ if (rc == 0) {
mdd_ref_add_internal(env, mdd_obj, handle);
+ la_copy->la_ctime = CURRENT_SECONDS;
+ la_copy->la_valid = LA_CTIME;
+ rc = mdd_attr_set_internal(env, mdd_obj, la_copy, handle, 0);
+ }
mdd_write_unlock(env, mdd_obj);
mdd_trans_stop(env, mdd, 0, handle);