Skip to content
Snippets Groups Projects
Commit 2deff473 authored by Carlos Tripiana Montes's avatar Carlos Tripiana Montes Committed by Danny Auble
Browse files

job_container/tmpfs: Add remount flag for _create_ns

This flags checks if we are going to allow the NS creation over a
previously used mount point.

Right now, no change in behavior. Since the only call to _create_ns has
remount to false, thus falling to the old behavior.

In preparation for subsequent changes.

Bug 11093
parent 916fcb83
No related branches found
No related tags found
No related merge requests found
......@@ -318,7 +318,7 @@ static int _rm_data(const char *path, const struct stat *st_buf,
return 0;
}
static int _create_ns(uint32_t job_id)
static int _create_ns(uint32_t job_id, bool remount)
{
char job_mount[PATH_MAX];
char ns_holder[PATH_MAX];
......@@ -345,7 +345,7 @@ static int _create_ns(uint32_t job_id)
error("%s: mkdir %s failed: %s",
__func__, job_mount, strerror(errno));
return -1;
} else if (rc && errno == EEXIST) {
} else if (!remount && rc && errno == EEXIST) {
/* stat to see if .active exists */
struct stat st;
rc = stat(active, &st);
......@@ -390,7 +390,7 @@ static int _create_ns(uint32_t job_id)
}
rc = mkdir(src_bind, 0700);
if (rc) {
if (rc && (!remount || errno != EEXIST)) {
error("%s: mkdir failed %s, %s",
__func__, src_bind, strerror(errno));
goto exit2;
......@@ -560,7 +560,7 @@ exit2:
extern int container_p_create(uint32_t job_id)
{
return _create_ns(job_id);
return _create_ns(job_id, false);
}
/* Add a process to a job container, create the proctrack container to add */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment