From c3f0f6f8bd812fee4b2ab658a5cc9ac9167d387d Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Sat, 29 Jun 2024 18:31:23 +0100 Subject: [PATCH] core: try again bind mounting if the destination was already created If the destination mount point is on a shared filesystem and is missing on the first attempt, we try to create it, but then fail with -EEXIST if something else created it in the meanwhile. Enter the retry logic on EEXIST, as we can just use the mount point if it was already created. Fixes https://github.com/systemd/systemd/issues/29690 --- src/core/namespace.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/namespace.c b/src/core/namespace.c index 57518ad7ff..7b26792790 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -1762,11 +1762,11 @@ static int apply_one_mount( (void) mkdir_parents(mount_entry_path(m), 0755); q = make_mount_point_inode_from_path(what, mount_entry_path(m), 0755); - if (q < 0) { - if (q != -EEXIST) // FIXME: this shouldn't be logged at LOG_WARNING, but be bubbled up, and logged there to avoid duplicate logging - log_warning_errno(q, "Failed to create destination mount point node '%s', ignoring: %m", - mount_entry_path(m)); - } else + if (q < 0 && q != -EEXIST) + // FIXME: this shouldn't be logged at LOG_WARNING, but be bubbled up, and logged there to avoid duplicate logging + log_warning_errno(q, "Failed to create destination mount point node '%s', ignoring: %m", + mount_entry_path(m)); + else try_again = true; } -- 2.25.1