]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Avoid error when bind mount source already exists
authorStefan Agner <stefan@agner.ch>
Mon, 28 Dec 2020 20:46:40 +0000 (21:46 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 25 Jan 2021 03:30:36 +0000 (12:30 +0900)
src/core/mount.c

index 5479cf7bf21f4dfbed808dcc992994ee5493484b..1ad80886cd0802ca8a5964895eae731120c2d695 100644 (file)
@@ -1010,7 +1010,9 @@ static void mount_enter_mounting(Mount *m) {
         p = get_mount_parameters_fragment(m);
         if (p && mount_is_bind(p)) {
                 r = mkdir_p_label(p->what, m->directory_mode);
-                if (r < 0)
+                /* mkdir_p_label() can return -EEXIST if the target path exists and is not a directory - which is
+                 * totally OK, in case the user wants us to overmount a non-directory inode. */
+                if (r < 0 && r != -EEXIST)
                         log_unit_error_errno(UNIT(m), r, "Failed to make bind mount source '%s': %m", p->what);
         }