chiark / gitweb /
nspawn: ignore EEXIST when creating mount point
authorDave Reisner <dreisner@archlinux.org>
Wed, 29 Oct 2014 17:32:43 +0000 (13:32 -0400)
committerDave Reisner <dreisner@archlinux.org>
Wed, 29 Oct 2014 17:42:51 +0000 (13:42 -0400)
A combination of commits f3c80515c and 79d80fc14 cause nspawn to
silently fail with a commandline such as:

  # systemd-nspawn -D /build/extra-x86_64 --bind=/usr

strace shows the culprit:

  [pid 27868] writev(2, [{"Failed to create mount point /build/extra-x86_64/usr: File exists", 82}, {"\n", 1}], 2) = 83

src/nspawn/nspawn.c

index b6d9bc631cb7adf55223806b00d4032dd6d910b4..d88987a5808f0d7e2340fa9fb7864102b52cec5b 100644 (file)
@@ -758,7 +758,7 @@ static int mount_binds(const char *dest, char **l, bool ro) {
                  * and char devices. */
                 if (S_ISDIR(source_st.st_mode)) {
                         r = mkdir_label(where, 0755);
-                        if (r < 0) {
+                        if (r < 0 && errno != EEXIST) {
                                 log_error("Failed to create mount point %s: %s", where, strerror(-r));
 
                                 return r;