dist/common/scripts/scylla_raid_setup: prevent 'device or resource busy' on creating mdraid device

According to this web site, there is possibility we have race condition with
mdraid creation vs udev:
http://dev.bizo.com/2012/07/mdadm-device-or-resource-busy.html
And looks like it can happen on our AMI, too (see #2784).

To initialize RAID safely, we should wait udev events are finished before and
after mdadm executed.

Fixes #2784

Signed-off-by: Takuya ASADA <syuu@scylladb.com>
Message-Id: <1505898196-28389-1-git-send-email-syuu@scylladb.com>
This commit is contained in:
Takuya ASADA
2017-09-20 18:03:16 +09:00
committed by Avi Kivity
parent fc644a8778
commit 4a8ed4cc6f

View File

@@ -96,7 +96,9 @@ elif is_gentoo_variant; then
emerge -uq sys-fs/mdadm sys-fs/xfsprogs
fi
if [ "$ID" = "ubuntu" ] && [ "$VERSION_ID" = "14.04" ]; then
udevadm settle
mdadm --create --verbose --force --run $RAID --level=0 -c1024 --raid-devices=$NR_DISK $DISKS
udevadm settle
mkfs.xfs $RAID -f
else
for dsk in $DISKS; do
@@ -107,7 +109,9 @@ else
fi
done
wait
udevadm settle
mdadm --create --verbose --force --run $RAID --level=0 -c1024 --raid-devices=$NR_DISK $DISKS
udevadm settle
mkfs.xfs $RAID -f -K
fi
if is_debian_variant; then