Browse Source

Revert "nbd: use systemd-run to start nbd-client"

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 9fd0461b7d.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
master
Luiz Angelo Daros de Luca 4 years ago committed by Harald Hoyer
parent
commit
ba3f4cdadc
  1. 20
      modules.d/95nbd/nbdroot.sh

20
modules.d/95nbd/nbdroot.sh

@ -109,25 +109,9 @@ if strstr "$(nbd-client --help 2>&1)" "systemd-mark"; then @@ -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

Loading…
Cancel
Save