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.
This commit is contained in:
Lennart Poettering
2021-03-26 11:39:37 +01:00
parent 9d0619dee7
commit 670e8efd60
+4
View File
@@ -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;