-
Notifications
You must be signed in to change notification settings - Fork 288
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
ignore return code of fstrim #721
Conversation
Thanks for the contribution! I guess this should be unproblematic. |
Can we ignore a specific return code instead of ignoring all return codes? It would be even better if we could check if fstrim is supported before running fstrim but I guess detecting if it's supported might not be trivial. |
|
Yes, please rework this to just use fstrim's --quiet-unsupported switch, which will just make the unsupported error go away, but all other errors will still be fatal and be logged. |
@poettering Tried the flag first, but this seems to only surpress the output not the error code. |
See https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/tree/sys-utils/fstrim.c#n544 rc = fstrim_filesystem(&ctl, path, NULL);
if (rc == 1 && !ctl.quiet_unsupp)
warnx(_("%s: the discard operation is not supported"), path);
return rc == 0 ? EXIT_SUCCESS : EXIT_FAILURE; |
b40e534
to
940c05a
Compare
removed the non-existing co-author |
devices (i.e. virtualized) may not support fstrim operations.
940c05a
to
5d01afb
Compare
Sorry for taking so long on this. Can we run the process (without the flag) and check the returncode and the output to figure out if the failure is due to fstrim being unsupported? If it's due to any other error, we can call |
@karelzak shouldn't fstrim suppress not only the warning but also the unclean exit code when --quiet-unsupported it specified? i.e. isn't this something to fix in the fstrim tool? |
Id probably merge this PR as it is though, the fstrim stuff is best-effort anyway, I doubt we need to put too much effort into working around the fact that we can't recognize the error cause properly here... I mean, even if @karelzak changes fstrim to return a clean exit code on EOPNOTSUPP, we should probably just work with released versions of fstrim too. |
This feature is already supported for -a and -A. Let's support it also when FS specified on command line. Addresses: systemd/mkosi#721 Signed-off-by: Karel Zak <kzak@redhat.com>
This feature is already supported for -a and -A. Let's support it also when FS specified on command line. Addresses: systemd/mkosi#721 Signed-off-by: Karel Zak <kzak@redhat.com>
devices (i.e. virtualized) may not support fstrim operations.