diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-05-01 19:25:53 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-05-20 07:26:05 +0200 |
commit | 874c40893540b0bfd41cee1c321419050dcf9db7 (patch) | |
tree | 3809b5b01a6df08795c5b42d448b2cb498041151 /rules.d/60-persistent-storage-tape.rules | |
parent | Merge pull request #27707 from mrc0mmand/tests (diff) | |
download | systemd-874c40893540b0bfd41cee1c321419050dcf9db7.tar.xz systemd-874c40893540b0bfd41cee1c321419050dcf9db7.zip |
udev: check existence of property before use
Diffstat (limited to 'rules.d/60-persistent-storage-tape.rules')
-rw-r--r-- | rules.d/60-persistent-storage-tape.rules | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/rules.d/60-persistent-storage-tape.rules b/rules.d/60-persistent-storage-tape.rules index 8c00cc76d9..803f82c583 100644 --- a/rules.d/60-persistent-storage-tape.rules +++ b/rules.d/60-persistent-storage-tape.rules @@ -6,16 +6,22 @@ ACTION=="remove", GOTO="persistent_storage_tape_end" ENV{UDEV_DISABLE_PERSISTENT_STORAGE_RULES_FLAG}=="1", GOTO="persistent_storage_tape_end" # type 8 devices are "Medium Changers" -SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --sg-version=3 --export --allowlisted -d $devnode", \ - SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL} tape/by-id/scsi-$env{ID_SERIAL}-changer" +SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="8", GOTO="medium_changer_begin" +GOTO="medium_changer_end" + +LABEL="medium_changer_begin" + +IMPORT{program}="scsi_id --sg-version=3 --export --allowlisted -d $devnode" +ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL} tape/by-id/scsi-$env{ID_SERIAL}-changer" # iSCSI devices from the same host have all the same ID_SERIAL, # but additionally a property named ID_SCSI_SERIAL. -SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="8", ENV{ID_SCSI_SERIAL}=="?*", \ - SYMLINK+="tape/by-id/scsi-$env{ID_SCSI_SERIAL}" +ENV{ID_SCSI_SERIAL}=="?*", SYMLINK+="tape/by-id/scsi-$env{ID_SCSI_SERIAL}" + +IMPORT{builtin}="path_id" +ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}-changer" -SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{builtin}="path_id", \ - SYMLINK+="tape/by-path/$env{ID_PATH}-changer" +LABEL="medium_changer_end" SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end" |