]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
udev-extraconf: mount.sh: check if filesystem is supported before mounting
authorLukas Funke <lukas.funke@weidmueller.com>
Wed, 8 Nov 2023 09:40:59 +0000 (10:40 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 10 Nov 2023 17:44:15 +0000 (17:44 +0000)
Check if the filesystem is supported by the kernel before trying to
mount it. Systemd-mount will mount the directories asynchronously
resulting in stale directories if the devices filesystem is not
supported.

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
meta/recipes-core/udev/udev-extraconf/mount.sh

index b7e86dbc0e61db6e81e4f10f149963ad6dcb72a1..0cd51fcde81cdf675c010781cf4676e138e6f06d 100644 (file)
@@ -36,6 +36,16 @@ do
        fi
 done
 
+is_filesystem_supported() {
+    while read -r fs; do
+       if [ "${fs#nodev}" = "$1" ];
+       then
+           return 0
+       fi
+    done < "/proc/filesystems"
+    return 1
+}
+
 automount_systemd() {
     name="`basename "$DEVNAME"`"
 
@@ -64,6 +74,11 @@ automount_systemd() {
         grep "^[[:space:]]*$tmp" /etc/fstab && return
     done
 
+    if ! is_filesystem_supported $ID_FS_TYPE; then
+        logger "mount.sh/automount" "Filesystem '$ID_FS_TYPE' on '${DEVNAME}' is unsupported"
+        return
+    fi
+
     [ -d "$MOUNT_BASE/$name" ] || mkdir -p "$MOUNT_BASE/$name"
 
     MOUNT="$MOUNT -o silent"