Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.2] zfs_setattr: fix atime update #15774

Merged

Conversation

robn
Copy link
Member

@robn robn commented Jan 14, 2024

Description

In 3c13601 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.

(backport #15773)

How Has This Been Tested?

Compile and sanity test against 5.10.x:

$ touch /tank/file
$ stat -c%x /tank/file
2024-01-14 03:06:50.926824089 +0000

The bug and fix are simple, so I'm assuming tests would show the same results as #15573.

[update]: existing ctime/mtime/atime modification test has been updated to check the update makes sense, not just that it was updated.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

@robn robn mentioned this pull request Jan 14, 2024
@robn robn force-pushed the zfs-setattr-atime-fix-2.2 branch 2 times, most recently from c0923c2 to 168c404 Compare January 14, 2024 22:07
@behlendorf
Copy link
Contributor

When you get a moment please update this PR to cherry pick the squashed commit f0bf7a2 from the master branch

@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Jan 16, 2024
In db4fc55 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 openzfs#15762
Closes openzfs#15773
@robn
Copy link
Member Author

robn commented Jan 16, 2024

@behlendorf done, thanks!

@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Jan 17, 2024
@behlendorf behlendorf merged commit 2ecc2df into openzfs:zfs-2.2.3-staging Jan 17, 2024
24 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants