Skip to content

Linux 4.11 compat: statx support #12432

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

Closed
wants to merge 2 commits into from
Closed

Conversation

ghost
Copy link

@ghost ghost commented Jul 26, 2021

Motivation and Context

Samba wants to know birthtime. We have it, we just need to fill it in.

Description

Rebase #8509 and add a simple test for ZTS.

How Has This Been Tested?

Added a test case to ZTS which stats a file for its birth time.

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:

@adamdmoss
Copy link
Contributor

(See also: #8507 #8509 )

@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Jul 26, 2021
Copy link
Contributor

@allanjude allanjude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed By: Allan Jude [email protected]

@ghost ghost force-pushed the birthtime branch from 91f9388 to 877c43e Compare July 26, 2021 19:00
@ghost
Copy link
Author

ghost commented Jul 26, 2021

I had not seen #8509 but that does seem like a better way of doing this. I'll go back and pick things up from there instead.

@ghost ghost force-pushed the birthtime branch from 877c43e to 6aade7b Compare July 26, 2021 20:19
@ghost ghost changed the title Linux: Populate btime in zfs_getattr_fast Linux 4.11 compat: statx support Jul 26, 2021
@ghost ghost force-pushed the birthtime branch from 6aade7b to 5e48bfe Compare July 27, 2021 11:41
@ghost
Copy link
Author

ghost commented Jul 27, 2021

Should I worry about skipping the test on older kernels?

Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can skip the new tests on older kernels in the same way it's done for functional/limits/filesystem_limit.ksh.

if is_linux; then
        if [[ $(linux_version) -lt $(linux_version "4.11") ]]; then
                log_unsupported "Requires statx(2) kernel support"
        fi
fi

@ghost ghost force-pushed the birthtime branch 2 times, most recently from c5dbb39 to 607bf05 Compare July 27, 2021 20:44
@ghost ghost force-pushed the birthtime branch from 607bf05 to 6ddd7e3 Compare July 27, 2021 20:46
@ghost
Copy link
Author

ghost commented Jul 27, 2021

  • Rebased
  • zp __maybe_unused in zfs_getattr_impl

Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but I think you'll also need to add the new test case to zts-report.py.in to expect the test to be skipped on older kernels.

Linux 4.11 added a new statx system call that allows us to expose crtime
as btime. We do this by caching crtime in the znode to match how atime,
ctime and mtime are cached in the inode.

statx also introduced a new way of reporting whether the immutable,
append and nodump bits have been set. It adds support for reporting
compression and encryption, but the semantics on other filesystems is
not just to report compression/encryption, but to allow it to be turned
on/off at the file level. We do not support that.

We could implement semantics where we refuse to allow user modification
of the bit, but we would need to do a dnode_hold() in zfs_znode_alloc()
to find out encryption/compression information. That would introduce
locking that will have a minor (although unmeasured) performance cost.
It also would be inferior to zdb, which reports far more detailed
information. We therefore omit reporting of encryption/compression
through statx in favor of recommending that users interested in such
information use zdb.

Signed-off-by: Richard Yao <[email protected]>
Closes openzfs#8507
@ghost
Copy link
Author

ghost commented Jul 28, 2021

Something seems to be missing in this implementation. Debian 10 has kernel 4.19 and genuinely failed the test:

22:30:09.58 Incorrect crtime (0 != 1627425009)

And it's not the only one to fail in this way.

@behlendorf behlendorf added the Status: Work in Progress Not yet ready for general review label Jul 28, 2021
@ghost ghost force-pushed the birthtime branch from 6ddd7e3 to 5d903f1 Compare July 29, 2021 17:16
@ghost
Copy link
Author

ghost commented Jul 30, 2021

The issue turns out to be that coreutils stat(1) doesn't support statx(2) until version 8.31, while buster provides version 8.30. I expect there is a similar reason for the other failed bots as well, so I'll see about checking the stat(1) version in the test as well.

Signed-off-by: Ryan Moeller <[email protected]>
@ghost ghost force-pushed the birthtime branch from 5d903f1 to 5ddd5c0 Compare July 30, 2021 16:30
@ghost
Copy link
Author

ghost commented Jul 30, 2021

  • Also check stat(1) version in crtime test

@ghost ghost removed the Status: Work in Progress Not yet ready for general review label Aug 2, 2021
@ghost ghost requested a review from tonynguien August 3, 2021 11:04
@tonynguien tonynguien added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Aug 5, 2021
@ghost ghost deleted the birthtime branch August 17, 2021 17:58
behlendorf pushed a commit to behlendorf/zfs that referenced this pull request Aug 23, 2021
Reviewed-by: Tony Nguyen <[email protected]>
Reviewed-by: Allan Jude <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12432
behlendorf pushed a commit to behlendorf/zfs that referenced this pull request Aug 24, 2021
Reviewed-by: Tony Nguyen <[email protected]>
Reviewed-by: Allan Jude <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12432
behlendorf pushed a commit to behlendorf/zfs that referenced this pull request Aug 24, 2021
Reviewed-by: Tony Nguyen <[email protected]>
Reviewed-by: Allan Jude <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12432
behlendorf pushed a commit to behlendorf/zfs that referenced this pull request Aug 24, 2021
Reviewed-by: Tony Nguyen <[email protected]>
Reviewed-by: Allan Jude <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12432
behlendorf pushed a commit that referenced this pull request Aug 31, 2021
Reviewed-by: Tony Nguyen <[email protected]>
Reviewed-by: Allan Jude <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes #12432
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Sep 15, 2021
Reviewed-by: Tony Nguyen <[email protected]>
Reviewed-by: Allan Jude <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12432
rincebrain pushed a commit to rincebrain/zfs that referenced this pull request Sep 22, 2021
Reviewed-by: Tony Nguyen <[email protected]>
Reviewed-by: Allan Jude <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12432
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.

6 participants