mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zdev: Improve handling of invalid udev rules
Add basic checking when reading udev rules and print a warning when an
invalid udev rule file is found. This addresses the current inconsistent
behavior:
- CCW devices: invalid udev rules are considered valid
- CCW group devices: invalid udev rules are silently ignored
- zFCP LUNs: invalid rules cause chzdev/lszdev to silently terminate
with non-zero exit code
Checks include a test for empty or truncated rule files that might be
the result of an interrupted chzdev operation, or a file system or I/O
error.
Note: The recommended way to correct invalid udev rules is to either
remove the offending rules file, or to repeat the associated persistent
configuration step.
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Reported-by: Steffen Maier <maier@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
5693c16894
commit
8b3cc6e4c1
@@ -393,6 +393,9 @@ static exit_code_t udev_read_zfcp_lun_rule(const char *filename,
|
||||
out:
|
||||
udev_free_file(file);
|
||||
|
||||
if (!node)
|
||||
warn_once("Warning: Invalid udev rule: %s\n", filename);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -475,11 +478,17 @@ static void zfcp_lun_node_to_state(struct zfcp_lun_node *node,
|
||||
struct attrib *a;
|
||||
char *name;
|
||||
|
||||
state->exists = 1;
|
||||
state->modified = 0;
|
||||
state->deconfigured = 0;
|
||||
state->definable = 0;
|
||||
|
||||
if (!node) {
|
||||
state->exists = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
state->exists = 1;
|
||||
|
||||
util_list_iterate(&node->fc_settings->list, s) {
|
||||
a = attrib_find(attribs, s->name);
|
||||
setting_list_add(state->settings,
|
||||
@@ -519,10 +528,7 @@ exit_code_t udev_zfcp_lun_read_device(struct device *dev, bool autoconf)
|
||||
goto out;
|
||||
|
||||
node = zfcp_lun_node_find(luns, dev->devid);
|
||||
if (node)
|
||||
zfcp_lun_node_to_state(node, st->dev_attribs, state);
|
||||
else
|
||||
rc = EXIT_DEVICE_NOT_FOUND;
|
||||
zfcp_lun_node_to_state(node, st->dev_attribs, state);
|
||||
|
||||
out:
|
||||
zfcp_lun_node_list_free(luns);
|
||||
|
||||
Reference in New Issue
Block a user