Merge pull request #89353 from wizeman/u/fix-zfs-ebusy

stage-1: retry mounting ZFS root a few times
This commit is contained in:
Lassulus 2020-08-22 15:42:32 +02:00 committed by GitHub
commit 6a2c73031a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -378,12 +378,14 @@ mountFS() {
mkdir -p "/mnt-root$mountPoint"
# For CIFS mounts, retry a few times before giving up.
# For ZFS and CIFS mounts, retry a few times before giving up.
# We do this for ZFS as a workaround for issue NixOS/nixpkgs#25383.
local n=0
while true; do
mount "/mnt-root$mountPoint" && break
if [ "$fsType" != cifs -o "$n" -ge 10 ]; then fail; break; fi
if [ \( "$fsType" != cifs -a "$fsType" != zfs \) -o "$n" -ge 10 ]; then fail; break; fi
echo "retrying..."
sleep 1
n=$((n + 1))
done