From: Lennart Poettering Date: Wed, 24 Mar 2021 12:47:17 +0000 (+0100) Subject: mount-until: make sure we'll exit bind_remount_recursive_with_mountinfo() loop eventually X-Git-Tag: v249-rc1~502^2~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=670e8efd6083bfef6186d33fa3b7dc90810d14ca;p=thirdparty%2Fsystemd.git mount-until: make sure we'll exit bind_remount_recursive_with_mountinfo() loop eventually Just some robustness given that /proc/self/mountinfo was previously broken in the kernel. --- diff --git a/src/shared/mount-util.c b/src/shared/mount-util.c index 53516c671b1..b9f46784db6 100644 --- a/src/shared/mount-util.c +++ b/src/shared/mount-util.c @@ -204,6 +204,7 @@ int bind_remount_recursive_with_mountinfo( _cleanup_set_free_free_ Set *done = NULL; _cleanup_free_ char *simplified = NULL; + unsigned n_tries = 0; int r; assert(prefix); @@ -239,6 +240,9 @@ int bind_remount_recursive_with_mountinfo( char *x; unsigned long orig_flags; + if (n_tries++ >= 32) /* Let's not retry this loop forever */ + return -EBUSY; + todo = set_new(&path_hash_ops); if (!todo) return -ENOMEM;