1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-10 05:18:17 +03:00

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

(cherry picked from commit c3f0f6f8bd)
This commit is contained in:
Luca Boccassi 2024-06-29 18:31:23 +01:00 committed by Luca Boccassi
parent 24987eb3cc
commit df990be913

View File

@ -1695,11 +1695,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
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
else
try_again = true;
}