diff options
author | Rob N <[email protected]> | 2024-01-17 09:01:17 +1100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2024-01-17 08:59:28 -0800 |
commit | 2ecc2dfe42707d8569e30f3b6a4526a0a825d479 (patch) | |
tree | 71985d8eaba2318c6671c44614c5568c72bb021a /tests/zfs-tests/cmd | |
parent | 9ecd112dc1dcdb903ebd3f1971cb1256094e73c4 (diff) |
Linux 6.7 compat: zfs_setattr fix atime update
In db4fc559c I messed up and changed this bit of code to set the inode
atime to an uninitialised value, when actually it was just supposed to
loading the atime from the inode to be stored in the SA. This changes it
to what it should have been.
Ensure times change by the right amount Previously, we only checked
if the times changed at all, which missed a bug where the atime was
being set to an undefined value.
Now ensure the times change by two seconds (or thereabouts), ensuring
we catch cases where we set the time to something bonkers
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Rob Norris <[email protected]>
Sponsored-by: https://despairlabs.com/sponsor/
Closes #15762
Closes #15773
Diffstat (limited to 'tests/zfs-tests/cmd')
-rw-r--r-- | tests/zfs-tests/cmd/ctime.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/zfs-tests/cmd/ctime.c b/tests/zfs-tests/cmd/ctime.c index 0f5d81aea..5ff1cea8a 100644 --- a/tests/zfs-tests/cmd/ctime.c +++ b/tests/zfs-tests/cmd/ctime.c @@ -362,12 +362,20 @@ main(void) return (1); } - if (t1 == t2) { - (void) fprintf(stderr, "%s: t1(%ld) == t2(%ld)\n", + + /* + * Ideally, time change would be exactly two seconds, but allow + * a little slack in case of scheduling delays or similar. + */ + long delta = (long)t2 - (long)t1; + if (delta < 2 || delta > 4) { + (void) fprintf(stderr, + "%s: BAD time change: t1(%ld), t2(%ld)\n", timetest_table[i].name, (long)t1, (long)t2); return (1); } else { - (void) fprintf(stderr, "%s: t1(%ld) != t2(%ld)\n", + (void) fprintf(stderr, + "%s: good time change: t1(%ld), t2(%ld)\n", timetest_table[i].name, (long)t1, (long)t2); } } |