Details
-
Improvement
-
Resolution: Unresolved
-
Major
-
Lustre 2.9.0
-
None
-
9223372036854775807
Description
When determining if a directory has recently been active, the client-provided timestamp in la_ctime is compared against the current time on the MDS. If the clocks are not synchronized on the client and the MDS, an incorrect elapsed time can be calculated. The comparison should instead be performed against the lr_contention_time in the resource, which is set by the MDS.
Andreas Dilger provided detailed information about the required changes:
if (!(child_bits & MDS_INODELOCK_UPDATE) && mdt_object_exists(child) && !mdt_object_remote(child)) { struct md_attr *ma = &info->mti_attr; ma->ma_valid = 0; ma->ma_need = MA_INODE; rc = mdt_attr_get_complex(info, child, ma); if (unlikely(rc != 0)) GOTO(out_child, rc); /* If the file has not been changed for some time, we * return not only a LOOKUP lock, but also an UPDATE * lock and this might save us RPC on later STAT. For * directories, it also let negative dentry cache start * working for this dir. */ if (ma->ma_valid & MA_INODE && ma->ma_attr.la_valid & LA_CTIME && info->mti_mdt->mdt_namespace->ns_ctime_age_limit + ma->ma_attr.la_ctime < cfs_time_current_sec()) child_bits |= MDS_INODELOCK_UPDATE; }
I think instead of looking up the inode and checking the client-supplied la_ctime on the directory against the MDS-local clock, this check should look up the resource and compare res->lr_contention_time via ldlm_check_contention() which uses only the clock on the server. That would remove similar, but different code, and unify lock contention behaviour between the OST and MDT somewhat.