Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-17963

sometime touch command cannot change mtime

Details

    • Bug
    • Resolution: Incomplete
    • Minor
    • None
    • None
    • None
    • 3
    • 9223372036854775807

    Description

      First create a file, then change its mtime immediately (touch command, or utimes/utimensat system call). Sometime mtime is not changed.

      The bug can be reproduced in sanity/39_d easily in the development of nanosecond timestamps, but rarely/never be reproduced in current version with second granularity timestamps.

      Attachments

        Issue Links

          Activity

            [LU-17963] sometime touch command cannot change mtime
            flei Feng Lei made changes -
            Link New: This issue is related to LU-1158 [ LU-1158 ]
            adilger Andreas Dilger made changes -
            Resolution New: Incomplete [ 4 ]
            Status Original: Reopened [ 4 ] New: Resolved [ 5 ]
            adilger Andreas Dilger made changes -
            Resolution Original: Won't Fix [ 2 ]
            Status Original: Closed [ 6 ] New: Reopened [ 4 ]

            We mark tickets Resolved instead of Closed, since it is still allows changing some fields of the ticket (eg. Labels, versions, etc).

            adilger Andreas Dilger added a comment - We mark tickets Resolved instead of Closed, since it is still allows changing some fields of the ticket (eg. Labels, versions, etc).
            flei Feng Lei made changes -
            Resolution New: Won't Fix [ 2 ]
            Status Original: Open [ 1 ] New: Closed [ 6 ]
            flei Feng Lei added a comment -

            In https://review.whamcloud.com/c/fs/lustre-release/+/53313, which enable nanosecond field for timestamps, the bug is fixed.

            If timestamps are still in second, the bug is never reproduced.

            This bug can be re-opened if sanity/test_39d failed.

            flei Feng Lei added a comment - In https://review.whamcloud.com/c/fs/lustre-release/+/53313, which enable nanosecond field for timestamps, the bug is fixed. If timestamps are still in second, the bug is never reproduced. This bug can be re-opened if sanity/test_39d failed.
            flei Feng Lei added a comment -

            utimes() is dropped only when new ctime is smaller than existing ctime. In the end of function mdd_fix_attr():

                if (la->la_valid & LA_CTIME) {
                    /**
                     * The pure setattr, it has the priority over what is
                     * already set, do not drop it if ctime is equal.
                     */
                    if (la->la_ctime < oattr->la_ctime)
                        la->la_valid &= ~(LA_ATIME | LA_MTIME | LA_CTIME);
                }
             

            This bug is actually found during the development of nanosecond timestamps. If the time granularity is nanosecond, it's easy to detect the difference of new ctime and old ctime. But if the time granularity is second, new ctime is almost always equal to old ctime. That's the reason it's not found in current lustre.

            flei Feng Lei added a comment - utimes() is dropped only when new ctime is smaller than existing ctime. In the end of function mdd_fix_attr():   if (la->la_valid & LA_CTIME) {         /**          * The pure setattr, it has the priority over what is          * already set, do not drop it if ctime is equal.          */         if (la->la_ctime < oattr->la_ctime)             la->la_valid &= ~(LA_ATIME | LA_MTIME | LA_CTIME);     } This bug is actually found during the development of nanosecond timestamps. If the time granularity is nanosecond, it's easy to detect the difference of new ctime and old ctime. But if the time granularity is second, new ctime is almost always equal to old ctime. That's the reason it's not found in current lustre.

            flei, I haven't checked, but is it possible that the utimes() update is dropped because the ctime is the same?

            adilger Andreas Dilger added a comment - flei , I haven't checked, but is it possible that the utimes() update is dropped because the ctime is the same ?

            "Feng Lei <flei@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/55497
            Subject: LU-17963 llite: get timestamps in an accurate way
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: fb383e763dc7e960024ce105141f4f41c915052b

            gerrit Gerrit Updater added a comment - "Feng Lei <flei@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/55497 Subject: LU-17963 llite: get timestamps in an accurate way Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: fb383e763dc7e960024ce105141f4f41c915052b
            flei Feng Lei added a comment -

            MDS has an optimization that: when setting file's timestamps, it compares the new ctime to be set with the existing ctime. If the new ctime is before the existing one, it will ignore the setting operation.

            In a tight operation series open/close/utimes, file's timestamps are firstly set by close(), then by utimes(). The utimes() operation gets ctime with current_time() function, which may get a lagged time than the real time. So there is a tiny window that: close() gets ctime at N seconds, but utimes() later get ctime at (N-1) second. Then the utimes() operation is ignored. 

            flei Feng Lei added a comment - MDS has an optimization that: when setting file's timestamps, it compares the new ctime to be set with the existing ctime. If the new ctime is before the existing one, it will ignore the setting operation. In a tight operation series open/close/utimes, file's timestamps are firstly set by close(), then by utimes(). The utimes() operation gets ctime with current_time() function, which may get a lagged time than the real time. So there is a tiny window that: close() gets ctime at N seconds, but utimes() later get ctime at (N-1) second. Then the utimes() operation is ignored. 

            People

              flei Feng Lei
              flei Feng Lei
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: