]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Revert "nbd: use systemd-run to start nbd-client"
authorLuiz Angelo Daros de Luca <luizluca@gmail.com>
Thu, 12 Nov 2020 01:19:06 +0000 (22:19 -0300)
committerHarald Hoyer <harald@hoyer.xyz>
Wed, 10 Feb 2021 14:02:41 +0000 (15:02 +0100)
systemd-run runs nbd-client in parallel. This introduces a possible
race condition when /dev/nbd0 is not directly used by /sysroot mount
but used by another dracut module as in:

  netroot=nbd:ip:port:fstype root=live:/dev/nbd0

Before nbd0 usages are synchronized, it is better to keep it serial.

This reverts commit 9fd0461b7d632c8e30f5241fff8306359b592438.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
modules.d/95nbd/nbdroot.sh

index 697387a614393dbb587c924d4289217abac01e27..7057f23329ff6cad14ec5d61beb75aef0024455c 100755 (executable)
@@ -109,25 +109,9 @@ if strstr "$(nbd-client --help 2>&1)" "systemd-mark"; then
 fi
 
 if [ "$nbdport" -gt 0 ] 2>/dev/null; then
-    if [ -z "$DRACUT_SYSTEMD" ]; then
-        nbd-client "$nbdserver" $nbdport /dev/nbd0 $preopts $opts || exit 1
-    else
-        systemd-run --no-block --service-type=forking --quiet \
-                    --description="nbd nbd0" \
-                    -p 'DefaultDependencies=no' \
-                    -p 'KillMode=none' \
-                    --unit="nbd0" -- nbd-client "$nbdserver" $nbdport /dev/nbd0 $preopts $opts >/dev/null 2>&1 || exit 1
-    fi
+    nbd-client "$nbdserver" $nbdport /dev/nbd0 $preopts $opts || exit 1
 else
-    if [ -z "$DRACUT_SYSTEMD" ]; then
-        nbd-client -name "$nbdport" "$nbdserver" /dev/nbd0 $preopts $opts || exit 1
-    else
-        systemd-run --no-block --service-type=forking --quiet \
-                    --description="nbd nbd0" \
-                    -p 'DefaultDependencies=no' \
-                    -p 'KillMode=none' \
-                    --unit="nbd0" --  nbd-client -name "$nbdport" "$nbdserver" /dev/nbd0 $preopts $opts >/dev/null 2>&1 || exit 1
-    fi
+    nbd-client -name "$nbdport" "$nbdserver" /dev/nbd0 $preopts $opts || exit 1
 fi
 
 # NBD doesn't emit uevents when it gets connected, so kick it