[lxc-devel] [lxc/master] mount: Allow over-mounting
stgraber on Github
lxc-bot at linuxcontainers.org
Sat Feb 16 01:11:20 UTC 2019
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190215/a22faa2c/attachment.bin>
-------------- next part --------------
From 5157d4d03422015dadcc6fd94362171f8d8a43c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Fri, 15 Feb 2019 20:02:07 -0500
Subject: [PATCH] mount: Cleanup allow over-mounting
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
src/lxc/lxccontainer.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index 667674ba0b..ec58510faa 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -4970,7 +4970,10 @@ static int create_mount_target(const char *dest, mode_t st_mode)
ret = mkdir(dest, 0000);
else
ret = mknod(dest, S_IFREG | 0000, 0);
- if (ret < 0) {
+
+ if (ret == 0)
+ TRACE("Created mount target \"%s\"", target);
+ else if (ret < 0 && ret != EEXIST) {
SYSERROR("Failed to create mount target \"%s\"", dest);
return -1;
}
@@ -5071,12 +5074,9 @@ static int do_lxcapi_mount(struct lxc_container *c, const char *source,
_exit(EXIT_FAILURE);
}
- if (access(target, F_OK) < 0 && errno == ENOENT) {
- ret = create_mount_target(target, sb.st_mode);
- if (ret < 0)
- _exit(EXIT_FAILURE);
- TRACE("Created mount target \"%s\"", target);
- }
+ ret = create_mount_target(target, sb.st_mode);
+ if (ret < 0)
+ _exit(EXIT_FAILURE);
suff = strrchr(template, '/');
if (!suff)
More information about the lxc-devel
mailing list