From eba5dcddfa8de36c33b9eb258f187edbe0afe7a2 Mon Sep 17 00:00:00 2001 From: Hector Palacios Date: Wed, 18 Sep 2019 10:26:55 +0200 Subject: udev-extraconf: skip mounting partitions already mounted by systemd For some devices, udev may sometimes trigger twice the 'add' rule during boot. Calling the mount.sh script twice will eventually fail for already mounted partitions, but in that case, the script tries to remove the created mountpoint, when it shouldn't. This has been observed on USB sticks connected to a USB hub and may result in devices not being mounted if plugged-in before booting. This patch checks for already mounted partitions earlier (before creating the mount point) and returns with no actions. (From OE-Core rev: 4cf076879ac038ebf76679a19249ea6363e63e0f) Signed-off-by: Hector Palacios Signed-off-by: Richard Purdie --- meta/recipes-core/udev/udev-extraconf/mount.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh index 79eb0145c2..b23731870e 100644 --- a/meta/recipes-core/udev/udev-extraconf/mount.sh +++ b/meta/recipes-core/udev/udev-extraconf/mount.sh @@ -38,6 +38,12 @@ done automount_systemd() { name="`basename "$DEVNAME"`" + # Skip already mounted partitions + if [ -f /run/systemd/transient/run-media-$name.mount ]; then + logger "mount.sh/automount" "/run/media/$name already mounted" + return + fi + # Skip the partition which are already in /etc/fstab grep "^[[:space:]]*$DEVNAME" /etc/fstab && return for n in LABEL PARTLABEL UUID PARTUUID; do -- cgit v1.2.3-54-g00ecf