X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftarget%2Fout_lib.c;h=c267ed20bf485970d76a7504b87ae0b8cdebbee1;hb=03bbd4c27471751ada57282fad15e074ae01e9d7;hp=98f274196ce066832cf6fa9e8e1662d133526045;hpb=e760042016bb5b12f9b21568304c02711930720f;p=fs%2Flustre-release.git diff --git a/lustre/target/out_lib.c b/lustre/target/out_lib.c index 98f2741..c267ed2 100644 --- a/lustre/target/out_lib.c +++ b/lustre/target/out_lib.c @@ -215,7 +215,6 @@ int out_create_pack(const struct lu_env *env, struct object_update *update, obdo->o_valid = 0; obdo_from_la(obdo, attr, attr->la_valid); - lustre_set_wire_obdo(NULL, obdo, obdo); if (parent_fid != NULL) { struct lu_fid *tmp; @@ -267,7 +266,6 @@ int out_attr_set_pack(const struct lu_env *env, struct object_update *update, obdo->o_valid = 0; obdo_from_la(obdo, attr, attr->la_valid); - lustre_set_wire_obdo(NULL, obdo, obdo); RETURN(0); } @@ -332,14 +330,13 @@ int out_index_delete_pack(const struct lu_env *env, } EXPORT_SYMBOL(out_index_delete_pack); -int out_object_destroy_pack(const struct lu_env *env, - struct object_update *update, - size_t *max_update_size, const struct lu_fid *fid) +int out_destroy_pack(const struct lu_env *env, struct object_update *update, + size_t *max_update_size, const struct lu_fid *fid) { return out_update_pack(env, update, max_update_size, OUT_DESTROY, fid, 0, NULL, NULL, 0); } -EXPORT_SYMBOL(out_object_destroy_pack); +EXPORT_SYMBOL(out_destroy_pack); int out_write_pack(const struct lu_env *env, struct object_update *update, size_t *max_update_size, const struct lu_fid *fid, @@ -748,10 +745,64 @@ static int out_tx_xattr_set_exec(const struct lu_env *env, ldata.ld_buf = &arg->u.xattr_set.buf; if (strcmp(arg->u.xattr_set.name, XATTR_NAME_LINK) == 0) { + struct link_ea_header *leh; + linkea = true; rc = linkea_init(&ldata); if (unlikely(rc)) GOTO(out, rc == -ENODATA ? -EINVAL : rc); + + leh = ldata.ld_leh; + LASSERT(leh != NULL); + + /* If the new linkEA contains overflow timestamp, + * then two cases: + * + * 1. The old linkEA for the object has already + * overflowed before current setting, the new + * linkEA does not contains new link entry. So + * the linkEA overflow timestamp is unchanged. + * + * 2. There are new link entry in the new linkEA, + * so its overflow timestamp is differnt from + * the old one. Usually, the overstamp in the + * given linkEA is newer. But because of clock + * drift among MDTs, the timestamp may become + * older. So here, we convert the timestamp to + * the server local time. Then namespace LFSCK + * that uses local time can handle it easily. */ + if (unlikely(leh->leh_overflow_time)) { + struct lu_buf tbuf = { 0 }; + bool update = false; + + lu_buf_alloc(&tbuf, MAX_LINKEA_SIZE); + if (tbuf.lb_buf == NULL) + GOTO(unlock, rc = -ENOMEM); + + rc = dt_xattr_get(env, dt_obj, &tbuf, + XATTR_NAME_LINK); + if (rc > 0) { + struct linkea_data tdata = { 0 }; + + tdata.ld_buf = &tbuf; + rc = linkea_init(&tdata); + if (rc || leh->leh_overflow_time != + tdata.ld_leh->leh_overflow_time) + update = true; + } else { + /* Update the timestamp by force if + * fail to load the old linkEA. */ + update = true; + } + + lu_buf_free(&tbuf); + if (update) { + leh->leh_overflow_time = + cfs_time_current_sec(); + if (unlikely(!leh->leh_overflow_time)) + leh->leh_overflow_time++; + } + } } else { linkea = false; } @@ -769,6 +820,8 @@ again: goto again; } } + +unlock: dt_write_unlock(env, dt_obj); }