-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Linux 4.11 compat: statx support #8509
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
Conversation
This has not been subject to tests on my local machines. Since I do not actually need this functionality myself, I am going to ask those that want it to test it on their machines to verify that the statx syscall is working properly. |
09fd73f
to
dd93db6
Compare
dce2f47
to
e09a4ef
Compare
Codecov Report
@@ Coverage Diff @@
## master #8509 +/- ##
==========================================
+ Coverage 78.55% 78.62% +0.07%
==========================================
Files 380 380
Lines 116324 116337 +13
==========================================
+ Hits 91375 91469 +94
+ Misses 24949 24868 -81
Continue to review full report at Codecov.
|
You are right. This is what I get for breaking my rules against coding in the evening and not pushing without doing local tests (although the buildbot was expected to do build tests). A friend had pinged me about this yesterday evening saying that it wasn't possible, so I threw together a patch to show otherwise. Then I noticed that there were some minor performance tweaks to be made and more to statx than just btime, so they got added. The end result was this. Anyway, I have properly looked at the kernel code this time. It still needs testing to confirm it works as expected, but the code should be right this time (fingers crossed). |
The project inherit tests breaking on Fedora might be a real regression because the pre-statx API sets a file attribute for FS_PROJINHERIT_FL, but statx does not allow us to expose that. This could indicate a bug in userspace or a bug in the tests, but I’ll need to set aside some time to look. I am just leaving a note here to indicate that I think there is a possible problem. |
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I'm all for adding support for the new interface.
However, before we can include this at a minimum we need to manually run the statx tests added to xfstests and verify they pass. We need to also add some basic tests cases to the ZTS since we are not automatically running xfstests.
As for reporting encryption and compression I think we should include that functionality in this PR. We don't need to allow setting either one of them. And for encryption it was intentionally decided not to allow it to be enabled/disabled at a file level of granularity.
As for the Fedora 29 failures those are unrelated. Currently the version of e2fsprogs in Fedora 29 has a known minor issue which was fixed, we're just waiting for them to update their packages.
@behlendorf Thanks for letting me know that the Fedora issue is pre-existing. That saved me some time. My development setup is somewhat stale. I’ll update it later today, run the new statx XFS test suite shortly afterward and add tests to ZTS in a day or two. I’ll look into adding support for the compression and encryption flags at that time. |
I built this on Ubuntu 18.10 and manually built coreutils from its git master.
I am unable to xfstests (either from upstream or zfsonlinux/xfstests, branch zfs-upstream) to work at all. The latter fails to build. |
@rlaager thanks for manually testing this. If we added some basic tests, like you've done above, to the ZFS Test Suite I think we'd be able to move forward with this. Running xfstests would be nice, but I understand it's currently challenging to run with ZFS, so we probably don't need to get hung up on that. That leaves the only missing functionality I think being reporting encryption and compression. @ryao what are your plans for this PR. Would you mind if someone else picked up this work? |
@behlendorf It has been on my todo list for a while, but it is fairly far down at the moment. I do not mind if some else does it. |
I noticed that this PR hasn’t been updated in some time. We would like to see this feature added, but it seems that it isn’t quite complete, so we’re going to close it for now. When you have time to revisit this work, feel free to reopen this PR or open a new one. Thanks for your contribution to OpenZFS and please continue to open PR’s to address issues that you encounter! |
From what I've read so far, the only things that need to be added are reporting compression and encryption, and adding the tests to the ZTS, right? If so, do y'all mind if I (try to) pick up on this? |
@sunflsks Sounds great! Open a new PR when you're ready. |
Motivation and Context
Support for statx was requested in #8507. This supersedes PR #8508.
Description
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.
How Has This Been Tested?
Types of changes
Checklist:
Signed-off-by
.