-
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
zpool trim -w does not wait for trim to end #10263
Comments
Tagging @jgallag88, per request |
Does zpool trim have a -w option?
|
@dentad #10071 |
Thanks for filing this @dioni21. I suspect the issue that you are hitting is that the
The issue is here. After we do the ioctl to start the trim, we check the return value and if it is non-zero, we skip the wait. However, the return value can indicate errors for devices that don't support trim ( The one difference between the example I've posted and the one you are hitting is the exit status of |
@dioni21 Do you by any chance have any aliases or other things in your shell environment that would have modified the exit status of |
Assuming that the problem I mentioned is the root cause of this issue, I think the best thing to do might be to ignore However, I think that it's potentially confusing that |
The intended behavior was to return an error when attempting to TRIM a specific vdev and it doesn't support TRIM. When attempting to TRIM an entire pool I agree it would make the most sense to not return an error as long as at least one of the vdevs supports the TRIM. |
--Suggested workaround until this is fixed in code: bash wrapper script to call zfs trim, and [pseudocode] while $(zpool status -v |grep -c '% trimmed') -gt 0 ; sleep 10 until it disappears
--Note this is untested, as I don't have any trim-supported ZFS devices atm |
You can also use |
No. My setup is compiled from git, using |
Strange. The only places I can see the return value of
In any case, I've opened #10372 to address the issues that we do understand. |
I browsed the code to see if I could find anything, and indeed most returns of 1 are in case of memory allocation errors. I think I saw something in vdev treatment, but could not be sure. Note that my setup has also special, logs and cache devices, while your test setup has not.
Thought this too, but the same same happens without |
I've merged the fix for the original issue here. If there are other fixes needed lets tackle them in follow up PRs as needed. |
When a manual trim is run against an entire pool, errors about particular devices which don't support trim are suppressed. This changes zpool_trim() in libzfs so that it doesn't return an error when the only errors are suppressed ones. An exception is made when none of the devices support trim, in which case an error is reported and a non-zero status is returned. This also fixes how the --wait flag works in the presence of suppressed errors. In particular, suppressed errors no longer cause zpool_trim() to skip the wait. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: John Gallagher <john.gallagher@delphix.com> Closes openzfs#10263 Closes openzfs#10372 (cherry picked from commit 50ff632)
When a manual trim is run against an entire pool, errors about particular devices which don't support trim are suppressed. This changes zpool_trim() in libzfs so that it doesn't return an error when the only errors are suppressed ones. An exception is made when none of the devices support trim, in which case an error is reported and a non-zero status is returned. This also fixes how the --wait flag works in the presence of suppressed errors. In particular, suppressed errors no longer cause zpool_trim() to skip the wait. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: John Gallagher <john.gallagher@delphix.com> Closes openzfs#10263 Closes openzfs#10372
System information
Describe the problem you're observing
I disabled autotrim and intend to run it at specified times. While testing the feature, I found that the
-w
flag does not work.Describe how to reproduce the problem
If I insist and do the command again:
Include any warning/errors/backtraces from the system logs
No error anywhere I could see
The text was updated successfully, but these errors were encountered: