aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHector Palacios <hector.palacios@digi.com>2019-09-18 10:26:55 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-09-19 10:54:26 +0100
commit4cf076879ac038ebf76679a19249ea6363e63e0f (patch)
tree1c32d4b5df90299eae0b052022b2185a18100809
parent7aaa9200b5ba2cba92ee1ed7003d54848498b37d (diff)
downloadopenembedded-core-contrib-4cf076879ac038ebf76679a19249ea6363e63e0f.tar.gz
openembedded-core-contrib-4cf076879ac038ebf76679a19249ea6363e63e0f.tar.bz2
openembedded-core-contrib-4cf076879ac038ebf76679a19249ea6363e63e0f.zip
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. Signed-off-by: Hector Palacios <hector.palacios@digi.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/udev/udev-extraconf/mount.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh
index 79eb0145c2a..b23731870ea 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