On Tue, Sep 16, 2025 at 2:39 AM Michael Chang via Grub-devel
<[email protected]> wrote:
>
> The grub_find_device function scans a starting directory, typically
> /dev, for device files with matching major and minor numbers. During
> this process, it recursively descends into subdirectories.
>
> However, this can significantly slow down the scan if a subdirectory is
> a mount point not related to devtmpfs, especially if it contains a large
> number of files.
>
> This patch modifies grub_find_device() to skip subdirectories that are
> mount points. A mount point is detected by comparing the st_dev of the
> subdirectory against that of the parent or starting directory. While
> this method does not catch all types of mounts, for eg bind mounts, it
> is a practical solution that avoids the need to parse /proc/self/mounts.
>
> Signed-off-by: Michael Chang <[email protected]>
> ---
>  grub-core/osdep/unix/getroot.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>

This looks reasonable to me.

Reviewed-by: Neal Gompa <[email protected]>



-- 
真実はいつも一つ!/ Always, there's only one truth!

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to