From: hongchao.zhang Date: Sat, 16 Jul 2011 22:16:55 +0000 (+0800) Subject: LU-221 don't use a/c/m time for newly allocated object in OST X-Git-Tag: 2.1.0-RC0~49 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=414251797ed178eec5d431e1f5aa4a889d2b159f;ds=sidebyside LU-221 don't use a/c/m time for newly allocated object in OST in OST, the a/c/m time is unusable for newly allocated object for it has not gotten valid time info from clients. by setting the a/c/m time as LONG_MIN at creation will make the clients ignore the time. Change-Id: I0d6094e4257626ffd1128b3540837deaf230e056 Signed-off-by: Hongchao Zhang Reviewed-on: http://review.whamcloud.com/1084 Tested-by: Hudson Reviewed-by: Andreas Dilger Reviewed-by: Niu Yawei Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index fb13c62..ad44312 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -3809,6 +3809,7 @@ static int filter_precreate(struct obd_device *obd, struct obdo *oa, struct dentry *dchild = NULL, *dparent = NULL; struct filter_obd *filter; struct obd_statfs *osfs; + struct iattr iattr; int err = 0, rc = 0, recreate_obj = 0, i; cfs_time_t enough_time = cfs_time_shift(DISK_TIMEOUT/2); __u64 os_ffree; @@ -3953,6 +3954,19 @@ static int filter_precreate(struct obd_device *obd, struct obdo *oa, dchild->d_inode->i_ino); set_last_id: + /* Set a/c/m time to a insane large negative value at creation + * time so that any timestamp arriving from the client will + * always be newer and update the inode. + * See LU-221 for details */ + iattr.ia_valid = ATTR_ATIME | ATTR_MTIME | ATTR_CTIME; + LTIME_S(iattr.ia_atime) = INT_MIN + 24 * 3600; + LTIME_S(iattr.ia_mtime) = INT_MIN + 24 * 3600; + LTIME_S(iattr.ia_ctime) = INT_MIN + 24 * 3600; + err = fsfilt_setattr(obd, dchild, handle, &iattr, 0); + if (err) + CERROR("unable to initialize a/c/m time of newly" + "created inode\n"); + if (!recreate_obj) { filter_set_last_id(filter, next_id, group); err = filter_update_last_objid(obd, group, 0);