-
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
zfs-import-{cache,scan}: change condition to FileNotEmpty #11568
Conversation
Sometimes(?) zfs generates an empty cache file for me, and the import fails, which is suboptimal, since this means that dracut fails, and I have to type in zpool import -a to boot, delete the file, and regenerate+reinstall the initrd This works around this by ignoring a clearly bogus cache, while still supporting systems that do utilise one Signed-off-by: Ahelenia Ziemiańska <[email protected]>
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.
The reason for this is that while the kernel provides interfaces to read/write existing files (from within the kernel), it does not provide one to remove a file. So in the case where we'd want to remove the cache file because all pools have been exported it's instead truncated to zero length. The zpool
utility already treats a zero-length cache file and a missing cache file the same, so it makes good sense to apply this same reasoning to these service files.
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.
This looks good to me. My only concern was whether ConditionFileNotEmpty was new (in systemd). I checked that and it has been available for a long time.
When all pools are exported ZFS will generate an empty cache file. This will cause the import service to fail, which is sub-optimal, since this means that dracut fails, and it necessary to run `zpool import -a` to boot, delete the file, and regenerate+reinstall the initrd. This resolves the issue by treating an zero-length cache files the same as a missing cache file. This aligns the behavior with that of the `zpool` command itself. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Richard Laager <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11568
When all pools are exported ZFS will generate an empty cache file. This will cause the import service to fail, which is sub-optimal, since this means that dracut fails, and it necessary to run `zpool import -a` to boot, delete the file, and regenerate+reinstall the initrd. This resolves the issue by treating an zero-length cache files the same as a missing cache file. This aligns the behavior with that of the `zpool` command itself. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Richard Laager <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes openzfs#11568
When all pools are exported ZFS will generate an empty cache file. This will cause the import service to fail, which is sub-optimal, since this means that dracut fails, and it necessary to run `zpool import -a` to boot, delete the file, and regenerate+reinstall the initrd. This resolves the issue by treating an zero-length cache files the same as a missing cache file. This aligns the behavior with that of the `zpool` command itself. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Richard Laager <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes openzfs#11568
Motivation and Context
Sometimes(?) zfs generates an empty cache file for me, and the import fails, which is suboptimal, since this means that dracut fails, and I have to type in zpool import -a to boot, delete the file, and regenerate+reinstall the initrd
Description
This works around this by ignoring a clearly bogus cache, while still supporting systems that do utilise one
How Has This Been Tested?
Applied equivalent change to the services on my laptop, regenerated and rebooted for each of the following: no cachefile => -scan, empty cachefile => -scan, non-empty cachefile => -cache. This is superiour to the previous behaviour of empty cachefile => -cache (failed).
Types of changes
Checklist:
Signed-off-by
.