-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fix filesystem_limit enforcement #8228
Conversation
As described in the zfs(8) man page the 'filesystem_limit' does not apply to users who are allowed to change the property. This was incorrectly failing because unlike all other operations the credential was being checked again outside the user context in the syncing context. Checking the stored user credential in a different context will always fail on Linux. See the comment above priv_policy_ns() for details. The proposed solution is to convert the CRED() to a kcred after the secpolicy_zfs() checks succeed in the calling context. This allows the check to be correctly performed a second time in the syncing context. To my surprise test cases were apparently never written for this features. If there had been some this may have been caught during the initial port, and we some look in to adding some. For the moment this change was manually tested. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
+1 for adding tests, i was investigating #8226 and found another issue with "filesystem_limit" which i am still debugging but was ready to test in a new "group": diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run
index f33a91649..c05225f18 100644
--- a/tests/runfiles/linux.run
+++ b/tests/runfiles/linux.run
@@ -514,6 +514,11 @@ tags = ['functional', 'cp_files']
tests = ['ctime_001_pos' ]
tags = ['functional', 'ctime']
+[tests/functional/dataset_limits]
+tests = ['filesystem_count', 'filesystem_limit', 'snapshot_count',
+ 'snapshot_limit']
+tags = ['functional', 'limits']
+
[tests/functional/deadman]
tests = ['deadman_sync', 'deadman_zio']
pre = |
Codecov Report
@@ Coverage Diff @@
## master #8228 +/- ##
==========================================
- Coverage 78.56% 78.51% -0.06%
==========================================
Files 379 379
Lines 114909 114904 -5
==========================================
- Hits 90284 90215 -69
- Misses 24625 24689 +64
Continue to review full report at Codecov.
|
@loli10K since it sounds like you've been looking in to this, and have already written some tests would you mind taking over this PR too. Based on the test runs we had two unexpected failure which need to explained, and we might want to take a slightly more targeted approach than the one suggested here.
|
@behlendorf i am probably a long way from being able to properly fix #8226, the "allow" code is somewhat new to me. I don't mind taking a stab at this though, seems like a good opportunity to study more ZFS code. The other issue i found is very similar to https://www.illumos.org/issues/6254 and hopefully i should be able to have a working fix this upcoming weekend. |
Alternative version is #8280 |
See issue openzfs#8226: Property filesystem_limit does not work as documented There have been previous attempts to fix the behavior on Linux, but so far the issue is still open. See PRs openzfs#8228, openzfs#8280. The existing tests pass for the incorrect behavior. This is a problem on FreeBSD; we are failing the tests because we implement the feature correctly. I have adapted the tests based on the work by @loli10K in openzfs#8280 and extended the changes to fix the snapshot_limit test as well. Linux now fails these tests, so entries linking to the issue have been added to the "maybe" group in zts-report.py. Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
See issue openzfs#8226: Property filesystem_limit does not work as documented There have been previous attempts to fix the behavior on Linux, but so far the issue is still open. See PRs openzfs#8228, openzfs#8280. The existing tests pass for the incorrect behavior. This is a problem on FreeBSD; we are failing the tests because we implement the feature correctly. I have adapted the tests based on the work by @loli10K in openzfs#8280 and extended the changes to fix the snapshot_limit test as well. Linux now fails these tests, so entries linking to the issue have been added to the "maybe" group in zts-report.py. Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
See issue #8226: Property filesystem_limit does not work as documented There have been previous attempts to fix the behavior on Linux, but so far the issue is still open. See PRs #8228, #8280. The existing tests pass for the incorrect behavior. This is a problem on FreeBSD; we are failing the tests because we implement the feature correctly. I have adapted the tests based on the work by @loli10K in #8280 and extended the changes to fix the snapshot_limit test as well. Linux now fails these tests, so entries linking to the issue have been added to the "maybe" group in zts-report.py. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #10082
See issue openzfs#8226: Property filesystem_limit does not work as documented There have been previous attempts to fix the behavior on Linux, but so far the issue is still open. See PRs openzfs#8228, openzfs#8280. The existing tests pass for the incorrect behavior. This is a problem on FreeBSD; we are failing the tests because we implement the feature correctly. I have adapted the tests based on the work by @loli10K in openzfs#8280 and extended the changes to fix the snapshot_limit test as well. Linux now fails these tests, so entries linking to the issue have been added to the "maybe" group in zts-report.py. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes openzfs#10082
Motivation and Context
Issue #8226. Observed 'filesystem_limit' behavior differs from that
described in the man page and code.
TODO: Investigate adding test cases for the filesystem_limit feature.
Description
As described in the zfs(8) man page the 'filesystem_limit' does not
apply to users who are allowed to change the property.
This was incorrectly failing because unlike all other operations
the credential was being checked again outside the user context in
the syncing context. Checking the stored user credential in a
different context will always fail on Linux. See the comment above
priv_policy_ns() for details.
The proposed solution is to convert the CRED() to a kcred after the
secpolicy_zfs() checks succeed in the calling context. This allows
the check to be correctly performed a second time in the syncing
context.
To my surprise test cases were apparently never written for this
feature. If there had been some this may have been caught during
the initial port, and we should look in to adding some. For the
moment this change was manually tested.
How Has This Been Tested?
Locally built and manually tested the failure scenario.
Types of changes
Checklist:
Signed-off-by
.