]> Git Repo - J-linux.git/commitdiff
overlayfs: set ctime when setting mtime and atime
authorJeff Layton <[email protected]>
Wed, 13 Sep 2023 13:33:12 +0000 (09:33 -0400)
committerChristian Brauner <[email protected]>
Mon, 25 Sep 2023 12:53:54 +0000 (14:53 +0200)
Nathan reported that he was seeing the new warning in
setattr_copy_mgtime pop when starting podman containers. Overlayfs is
trying to set the atime and mtime via notify_change without also
setting the ctime.

POSIX states that when the atime and mtime are updated via utimes() that
we must also update the ctime to the current time. The situation with
overlayfs copy-up is analogies, so add ATTR_CTIME to the bitmask.
notify_change will fill in the value.

Reported-by: Nathan Chancellor <[email protected]>
Signed-off-by: Jeff Layton <[email protected]>
Tested-by: Nathan Chancellor <[email protected]>
Acked-by: Christian Brauner <[email protected]>
Acked-by: Amir Goldstein <[email protected]>
Message-Id: <20230913-ctime-v1-1-c6bc509cbc27@kernel.org>
Signed-off-by: Christian Brauner <[email protected]>
fs/overlayfs/copy_up.c

index bae404a1bad48f8fa3611986a8bb77c77b2d8d32..557e46bc4361a79b9b8b38de3270c17b10d07a22 100644 (file)
@@ -337,7 +337,7 @@ static int ovl_set_timestamps(struct ovl_fs *ofs, struct dentry *upperdentry,
 {
        struct iattr attr = {
                .ia_valid =
-                    ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET,
+                    ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET | ATTR_CTIME,
                .ia_atime = stat->atime,
                .ia_mtime = stat->mtime,
        };
This page took 0.046531 seconds and 4 git commands to generate.