Merge pull request #253488 from nh2/install-grub-dont-stat-network-fs

install-grub.pl: Do stat() last to not hang on hanging network FS

Changed files
+5 -1
nixos
modules
system
boot
loader
+5 -1
nixos/modules/system/boot/loader/grub/install-grub.pl
···
chomp $fs;
my @fields = split / /, $fs;
my $mountPoint = $fields[4];
-
next unless -d $mountPoint;
my @mountOptions = split /,/, $fields[5];
# Skip the optional fields.
···
# Is it better than our current match?
if (length($mountPoint) > length($bestFs->mount)) {
$bestFs = Fs->new(device => $device, type => $fsType, mount => $mountPoint);
}
}
···
chomp $fs;
my @fields = split / /, $fs;
my $mountPoint = $fields[4];
my @mountOptions = split /,/, $fields[5];
# Skip the optional fields.
···
# Is it better than our current match?
if (length($mountPoint) > length($bestFs->mount)) {
+
+
# -d performs a stat, which can hang forever on network file systems,
+
# so we only make this call last, when it's likely that this is the mount point we need.
+
next unless -d $mountPoint;
+
$bestFs = Fs->new(device => $device, type => $fsType, mount => $mountPoint);
}
}