summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNed Bass <[email protected]>2011-04-01 09:47:05 -0700
committerBrian Behlendorf <[email protected]>2011-04-05 13:00:51 -0700
commitfa417e57a68b7aa026ec5fd8c0471b6c60ca109f (patch)
treeb767b6b2906a67f1ba23283a3a8a4fb3dfbaa14e
parent34e4864009d32da5fe29393082a56b5272f65faa (diff)
Call udevadm trigger more safely
Some udev hooks are not designed to be idempotent, so calling udevadm trigger outside of the distribution's initialization scripts can have unexpected (and potentially dangerous) side effects. For example, the system time may change or devices may appear multiple times. See Ubuntu launchpad bug 320200 and this mailing list post for more details: https://lists.ubuntu.com/archives/ubuntu-devel/2009-January/027260.html To avoid these problems we call udevadm trigger with --action=change --subsystem-match=block. The first argument tells udev just to refresh devices, and make sure everything's as it should be. The second argument limits the scope to block devices, so devices belonging to other subsystems cannot be affected. This doesn't fix the problem on older udev implementations that don't provide udevadm but instead have udevtrigger as a standalone program. In this case the above options aren't available so there's no way to call call udevtrigger safely. But we can live with that since this issue only exists in optional test and helper scripts, and most zfs-on-linux users are running newer systems anyways.
-rwxr-xr-xcmd/zpool_layout/zpool_layout2
-rw-r--r--scripts/common.sh.in2
2 files changed, 2 insertions, 2 deletions
diff --git a/cmd/zpool_layout/zpool_layout b/cmd/zpool_layout/zpool_layout
index 432c1576e..7f19dc0e9 100755
--- a/cmd/zpool_layout/zpool_layout
+++ b/cmd/zpool_layout/zpool_layout
@@ -153,7 +153,7 @@ exec 1>&8 8>&-
popd >/dev/null
if [ ${TRIGGER} = "yes" ]; then
- udevadm trigger
+ udevadm trigger --action=change --subsystem-match=block
udevadm settle
fi
diff --git a/scripts/common.sh.in b/scripts/common.sh.in
index 2583efcb2..cf5585945 100644
--- a/scripts/common.sh.in
+++ b/scripts/common.sh.in
@@ -430,7 +430,7 @@ scsi_rescan() {
#
udev_trigger() {
if [ -f ${UDEVADM} ]; then
- ${UDEVADM} trigger
+ ${UDEVADM} trigger --action=change --subsystem-match=block
${UDEVADM} settle
else
/sbin/udevtrigger