about summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorNiklas Hambüchen <mail@nh2.me>2023-04-23 04:29:58 +0000
committerNiklas Hambüchen <mail@nh2.me>2024-01-23 15:34:40 +0000
commitb9ba9df3e8e65b9e9428de86a72b9fa75e565f48 (patch)
tree6ac919c3a434862da1a1f18796feb6fad7701b0f /nixos/modules/system
parent3c15feef7770eb5500a4b8792623e2d6f598c9c1 (diff)
downloadnixlib-b9ba9df3e8e65b9e9428de86a72b9fa75e565f48.tar
nixlib-b9ba9df3e8e65b9e9428de86a72b9fa75e565f48.tar.gz
nixlib-b9ba9df3e8e65b9e9428de86a72b9fa75e565f48.tar.bz2
nixlib-b9ba9df3e8e65b9e9428de86a72b9fa75e565f48.tar.lz
nixlib-b9ba9df3e8e65b9e9428de86a72b9fa75e565f48.tar.xz
nixlib-b9ba9df3e8e65b9e9428de86a72b9fa75e565f48.tar.zst
nixlib-b9ba9df3e8e65b9e9428de86a72b9fa75e565f48.zip
install-grub.pl: Do stat() last to not hang on hanging network FS
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/boot/loader/grub/install-grub.pl6
1 files changed, 5 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/loader/grub/install-grub.pl b/nixos/modules/system/boot/loader/grub/install-grub.pl
index d1e7a0cb8178..6f0f62546a01 100644
--- a/nixos/modules/system/boot/loader/grub/install-grub.pl
+++ b/nixos/modules/system/boot/loader/grub/install-grub.pl
@@ -136,7 +136,6 @@ sub GetFs {
         chomp $fs;
         my @fields = split / /, $fs;
         my $mountPoint = $fields[4];
-        next unless -d $mountPoint;
         my @mountOptions = split /,/, $fields[5];
 
         # Skip the optional fields.
@@ -155,6 +154,11 @@ sub GetFs {
 
         # 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);
         }
     }