From 7062385b000b68ec1d32692de85a64c08efbd5a3 Mon Sep 17 00:00:00 2001 From: Noah Meyerhans Date: Mon, 15 Nov 2021 17:39:10 -0800 Subject: [PATCH] Restrict NVME udev rules to "add" events The rules are intended to set up symlinks and parameters on NVME devices as they're added, and it's not expected that they'll run on "change", "remove", or other udev events. --- 70-ec2-nvme-devices.rules | 14 +++++++------- amazon-ec2-utils.spec | 5 ++++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/70-ec2-nvme-devices.rules b/70-ec2-nvme-devices.rules index 3df1ecd..64c3158 100644 --- a/70-ec2-nvme-devices.rules +++ b/70-ec2-nvme-devices.rules @@ -5,18 +5,18 @@ # the License. #nvme-ns-* devices -KERNEL=="nvme[0-9]*n[0-9]*", ENV{DEVTYPE}=="disk", ATTRS{serial}=="?*", ATTRS{model}=="?*", SYMLINK+="disk/by-id/nvme-$attr{model}_$attr{serial}-ns-%n", OPTIONS+="string_escape=replace" +ACTION="add", KERNEL=="nvme[0-9]*n[0-9]*", ENV{DEVTYPE}=="disk", ATTRS{serial}=="?*", ATTRS{model}=="?*", SYMLINK+="disk/by-id/nvme-$attr{model}_$attr{serial}-ns-%n", OPTIONS+="string_escape=replace" #nvme partitions -KERNEL=="nvme[0-9]*n[0-9]*p[0-9]*", ENV{DEVTYPE}=="partition", ATTRS{serial}=="?*", ATTRS{model}=="?*", IMPORT{program}="ec2nvme-nsid %k" -KERNEL=="nvme[0-9]*n[0-9]*p[0-9]*", ENV{DEVTYPE}=="partition", ATTRS{serial}=="?*", ATTRS{model}=="?*", ENV{_NS_ID}=="?*", SYMLINK+="disk/by-id/nvme-$attr{model}_$attr{serial}-ns-$env{_NS_ID}-part%n", OPTIONS+="string_escape=replace" +ACTION="add", KERNEL=="nvme[0-9]*n[0-9]*p[0-9]*", ENV{DEVTYPE}=="partition", ATTRS{serial}=="?*", ATTRS{model}=="?*", IMPORT{program}="ec2nvme-nsid %k" +ACTION="add", KERNEL=="nvme[0-9]*n[0-9]*p[0-9]*", ENV{DEVTYPE}=="partition", ATTRS{serial}=="?*", ATTRS{model}=="?*", ENV{_NS_ID}=="?*", SYMLINK+="disk/by-id/nvme-$attr{model}_$attr{serial}-ns-$env{_NS_ID}-part%n", OPTIONS+="string_escape=replace" # ebs nvme devices -KERNEL=="nvme[0-9]*n[0-9]*", ENV{DEVTYPE}=="disk", ATTRS{model}=="Amazon Elastic Block Store", PROGRAM="/sbin/ebsnvme-id -u /dev/%k", SYMLINK+="%c" -KERNEL=="nvme[0-9]*n[0-9]*p[0-9]*", ENV{DEVTYPE}=="partition", ATTRS{model}=="Amazon Elastic Block Store", PROGRAM="/sbin/ebsnvme-id -u /dev/%k", SYMLINK+="%c%n" +ACTION="add", KERNEL=="nvme[0-9]*n[0-9]*", ENV{DEVTYPE}=="disk", ATTRS{model}=="Amazon Elastic Block Store", PROGRAM="/sbin/ebsnvme-id -u /dev/%k", SYMLINK+="%c" +ACTION="add", KERNEL=="nvme[0-9]*n[0-9]*p[0-9]*", ENV{DEVTYPE}=="partition", ATTRS{model}=="Amazon Elastic Block Store", PROGRAM="/sbin/ebsnvme-id -u /dev/%k", SYMLINK+="%c%n" # Do not timeout I/O operations on EBS volumes. -KERNEL=="nvme[0-9]*n[0-9]*", ENV{DEVTYPE}=="disk", ATTRS{model}=="Amazon Elastic Block Store", ATTR{queue/io_timeout}="4294967295" +ACTION="add", KERNEL=="nvme[0-9]*n[0-9]*", ENV{DEVTYPE}=="disk", ATTRS{model}=="Amazon Elastic Block Store", ATTR{queue/io_timeout}="4294967295" # instance store nvme devices -KERNEL=="nvme[0-9]*n[0-9]*", ENV{DEVTYPE}=="disk", ATTRS{model}=="Amazon EC2 NVMe Instance Storage", ATTR{queue/io_timeout}="90000" +ACTION="add", KERNEL=="nvme[0-9]*n[0-9]*", ENV{DEVTYPE}=="disk", ATTRS{model}=="Amazon EC2 NVMe Instance Storage", ATTR{queue/io_timeout}="90000" diff --git a/amazon-ec2-utils.spec b/amazon-ec2-utils.spec index 52a5f9f..3f93845 100644 --- a/amazon-ec2-utils.spec +++ b/amazon-ec2-utils.spec @@ -1,7 +1,7 @@ Name: amazon-ec2-utils Summary: A set of tools for running in EC2 Version: 1.3 -Release: 4%{?dist} +Release: 5%{?dist} License: MIT Group: System Tools @@ -91,6 +91,9 @@ rm -rf $RPM_BUILD_ROOT %{_sysconfdir}/udev/rules.d/70-ec2-nvme-devices.rules %changelog +* Tue Nov 16 2021 Noah Meyerhans 1.3-5 +- Restrict NVME udev rules to "add" events + * Tue Apr 20 2021 Hailey Mothershead 1.3-4 - Add udev rule to increase read_ahead_kb when an NFS share is mounted