Skip to main content

Timestamps and what moves them

Every object in the file system has three timestamps: atime (when the object was last read), mtime (when its content last changed), and ctime (when its content or its metadata last changed). This page lists which operation changes which of the three timestamps, whose clock writes the values, and what else in the system reads them.

The Master Server's clock writes every timestamp​

The Master Server stamps each operation that it executes with its own clock at that moment. The access and modification times produced by reading and writing through a mount are recorded differently but use the same clock. The mount reports these times in batches. Each reported time is already stamped with the Master Server's time. Client background work covers that reporting. A reported time only advances a timestamp. The Master Server drops a value that is earlier than the value it already holds. A reported mtime that does advance also advances ctime.

The values are whole seconds of Unix time and are stored in 32-bit fields. Nothing finer than a second is stored. Because every value is either the Master Server's own time or expressed in that time, a wrong clock on a client machine changes no timestamp. A wrong client clock changes how the stored timestamps read. The client works in its own local time. A file's age, find -mtime, and a build that compares a file in the mount with a file outside the mount therefore all measure against the client clock. Keep the clocks of the client machines synchronized with the Master Server's clock, so that those comparisons measure against the same time (keep every machine's clock in step).

Each operation moves a fixed set of timestamps​

OperationWhat moves
Creating a file, directory, or symlinkAll three on the new object, plus mtime and ctime of the directory
Reading file dataatime, as far as ATIME_MODE allows
Listing a directory, reading a symlinkatime of the directory or symlink, under the same option
Writing file datamtime and ctime
Truncating a file, including open with O_TRUNCmtime and ctime
chmod, chown, and every other attribute changectime. Setting the times themselves (touch) also writes the requested atime and mtime
Setting an extended attributectime
Setting or removing an ACLctime. Up to 5.1.0, only when the change also altered the permission bits
Renamingctime of the moved object and of a replaced target, plus mtime and ctime of both directories
Creating a hard linkctime of the target file, plus mtime and ctime of the directory
Removing a namectime of the object that carried it, plus mtime and ctime of the directory
Taking a snapshotNothing on the source. The copy keeps the source's atime, mtime, and ctime
mfssetsclass, mfssettrashretention, mfsseteattr, mfsclrarchivectime of every object the command actually changes. For mfsclrarchive, ctime of every file it covers

Two rows differ from what a local file system does. The maintenance commands in the last row change metadata, so they change ctime in the same way as chmod does. An object that a command leaves unchanged keeps its ctime. The two commands that set and clear the archive flag are exceptions to these rules. mfssetarchive changes no timestamp. mfsclrarchive changes the ctime of every file that it covers, including a file whose flags it did not change. Only a file that the command skips keeps its ctime: a file owned by someone else or an immutable file. The snapshot row describes a new copy. A new copy keeps the source's three times, no matter who makes the copy. An object that the snapshot overwrites keeps the source's ctime only when root or the owner runs the snapshot. When anyone else runs the snapshot, the object gets the snapshot time instead. With mfsmakesnapshot -c, a new copy gets the snapshot time for all three timestamps.

ATIME_MODE decides whether reading moves atime​

ATIME_MODE in mfsmaster.cfg sets how much of the atime traffic is kept. The default works the way a Linux "relatime" mount does. A read changes atime only when atime is older than ctime or mtime, or older than 24 hours. The remaining settings always change atime, change atime only for files, or never change atime. The option is configured on the Master Server, so one setting covers every mount. There is no per-mount switch. A mount with -o ro, and a session that an export entry admits read-only, change atime the same way.

Archiving measures ctime, and chmod moves it​

The archive rule of a Storage Class waits until the timestamps that the rule selects are older than the rule's delay. The rule selects ctime unless the class says otherwise. Storage Class evaluation covers that rule. The operation table shows that chmod, chown, extended attributes, and the maintenance commands all change ctime. Under a ctime-measured rule, each of these operations therefore restarts the archive delay for the whole file. Under a reversible rule, each of these operations also moves archived chunks back to KEEP. A class meant to archive by the age of the data measures mtime instead. Clearing the archive flag by hand follows the same logic in reverse. mfsclrarchive changes ctime, so a ctime-measured rule counts from the clearing. The rule does not re-archive the file on the next pass.

Trash retention waits on all three timestamps​

A trash entry expires only once atime, mtime, and ctime are all older than the retention. Deletion itself changes ctime, so the wait is never shorter than the full retention.