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
Let is_write_protected() report devices without device node as not write protected #3091
Conversation
Let the is_write_protected function report candidate devices without device node as not write protected because not all /sys/block devices have a "dev" file e.g. /sys/block/nvme0c0n1 has no /dev/nvme0c0n1 device node see #3085 Because the is_write_protected function is meant to identify write-protected disks and partitions only candidate devices with a device node are considered for write protection
@pcahyna |
Completely overhauled lib/write-protect-functions.sh which now contains only the is_write_protected function (the only one intened to be called by other scripts). The former helper functions are not needed as functions because all what actually happens is a single straightforward sequence of actions. So what the helper functions did is now done step by step directly in the is_write_protected function. This avoids in particular RFC 1925 item (6a).
Oops - I did it again ;-) Because I got confused by the former helper functions |
I did some tests on my test system |
Some comment text improvements and some improved variable names to better describe and tell what things actually are
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.
In general I approve, although I also can't really test this specific code for the same reason you can't test it. My motivation for approving is that ReaR should only concern itself with "real" disks, that also have a /dev
device node.
If indeed this device is part of NVMe multipathing then we should mention it in the comment and maybe keep in mind that NVMe multipathing is not yet properly supported.
Add reason "because it is part of NVMe multipathing" Co-authored-by: Schlomo Schapiro <schlomo+github@schapiro.org>
I wanted to test it more but I don't find time for that so |
Type: Bug Fix / Enhancement
Impact: Normal
Reference to related issue (URL):
write_protected_candidate_device called for '/sys/block/nvme0c0n1' but '/dev/nvme0c0n1' is no block device #3085
How was this pull request tested?
I don't know how I could test it.
I cannot reproduce the matching issue
because I don't have a system with /sys/block/nvme0c0n1
or something similar - i.e. where a /sys/block/device
does not have a matching /dev/device.
Let the is_write_protected function
report candidate devices without device node
as not write protected
because not all /sys/block devices have a "dev" file
e.g. /sys/block/nvme0c0n1 has no /dev/nvme0c0n1 device node, see
#3085
Because the is_write_protected function is meant
to identify write-protected disks and partitions
only candidate devices with a device node
are considered for write protection.