Message ID | 1479776840-23544-3-git-send-email-avagin@openvz.org |
---|---|
State | New |
Series | "Series without cover letter" |
Headers | show |
diff --git a/criu/mount.c b/criu/mount.c index 3a98e63..c76542b 100644 --- a/criu/mount.c +++ b/criu/mount.c @@ -3019,8 +3019,11 @@ static int do_umount_one(struct mount_info *mi) static int cr_pivot_root(char *root) { - char put_root[] = "crtools-put-root.XXXXXX"; + char tmp_dir_tmpl[] = "crtools-put-root.XXXXXX"; + bool tmp_dir = false; + char *put_root = "tmp"; int exit_code = -1; + struct stat st; pr_info("Move the root to %s\n", root ? : "."); @@ -3031,9 +3034,13 @@ static int cr_pivot_root(char *root) } } - if (mkdtemp(put_root) == NULL) { - pr_perror("Can't create a temporary directory"); - return -1; + if (stat(put_root, &st) || !S_ISDIR(st.st_mode)) { + put_root = mkdtemp(tmp_dir_tmpl); + if (put_root == NULL) { + pr_perror("Can't create a temporary directory"); + return -1; + } + tmp_dir = true; } if (mount(put_root, put_root, NULL, MS_BIND, NULL)) { @@ -3070,7 +3077,7 @@ err_tmpfs: } err_root: - if (rmdir(put_root)) { + if (tmp_dir && rmdir(put_root)) { pr_perror("Can't remove the directory %s", put_root); return -1; }
I've somehow lost 1/3 and 2/3 :( What are the subjects?
On Tue, Nov 22, 2016 at 02:45:46PM +0300, Pavel Emelyanov wrote:
> I've somehow lost 1/3 and 2/3 :( What are the subjects?
1063 C Nov 21 Andrey Vagin [PATCH criu 1/3] mount: handle error from restore_shared_options()
1064 C Nov 21 Andrey Vagin ├─>[PATCH criu 2/3] mount: fix mounting non-root shared mounts
1065 C Nov 21 Andrey Vagin └─>[PATCH criu 3/3] mount: don't create a temporary directory if /tmp exists
Cyrill
On Tue, Nov 22, 2016 at 03:44:35PM +0300, Pavel Emelyanov wrote: > On 11/22/2016 03:01 PM, Cyrill Gorcunov wrote: > > On Tue, Nov 22, 2016 at 02:45:46PM +0300, Pavel Emelyanov wrote: > >> I've somehow lost 1/3 and 2/3 :( What are the subjects? > > > > 1063 C Nov 21 Andrey Vagin [PATCH criu 1/3] mount: handle error from restore_shared_options() > > Cannot find one nor in my mailbox, nor on the ML archives :( > > > 1064 C Nov 21 Andrey Vagin ├─>[PATCH criu 2/3] mount: fix mounting non-root shared mounts > > This one sits in my mailbox as "[PATCH 2/2] mount: fix mounting non-root shared mounts". Is it the same? Hmm. Not sure :/ Mind simply grab them from criu-stable? https://src.openvz.org/projects/OVZ/repos/criu/commits?until=refs%2Fheads%2Fvz7-u3
On 11/22/2016 03:01 PM, Cyrill Gorcunov wrote: > On Tue, Nov 22, 2016 at 02:45:46PM +0300, Pavel Emelyanov wrote: >> I've somehow lost 1/3 and 2/3 :( What are the subjects? > > 1063 C Nov 21 Andrey Vagin [PATCH criu 1/3] mount: handle error from restore_shared_options() Cannot find one nor in my mailbox, nor on the ML archives :( > 1064 C Nov 21 Andrey Vagin ├─>[PATCH criu 2/3] mount: fix mounting non-root shared mounts This one sits in my mailbox as "[PATCH 2/2] mount: fix mounting non-root shared mounts". Is it the same? > 1065 C Nov 21 Andrey Vagin └─>[PATCH criu 3/3] mount: don't create a temporary directory if /tmp exists > > Cyrill > . >
On 11/22/2016 03:43 PM, Cyrill Gorcunov wrote: > On Tue, Nov 22, 2016 at 03:44:35PM +0300, Pavel Emelyanov wrote: >> On 11/22/2016 03:01 PM, Cyrill Gorcunov wrote: >>> On Tue, Nov 22, 2016 at 02:45:46PM +0300, Pavel Emelyanov wrote: >>>> I've somehow lost 1/3 and 2/3 :( What are the subjects? >>> >>> 1063 C Nov 21 Andrey Vagin [PATCH criu 1/3] mount: handle error from restore_shared_options() >> >> Cannot find one nor in my mailbox, nor on the ML archives :( >> >>> 1064 C Nov 21 Andrey Vagin ├─>[PATCH criu 2/3] mount: fix mounting non-root shared mounts >> >> This one sits in my mailbox as "[PATCH 2/2] mount: fix mounting non-root shared mounts". Is it the same? > > Hmm. Not sure :/ Mind simply grab them from criu-stable? > > https://src.openvz.org/projects/OVZ/repos/criu/commits?until=refs%2Fheads%2Fvz7-u3 > . > BTW, why isn't criu@openvz.org in Cc for this particular patch? %) -- Pavel
On 11/22/2016 03:44 PM, Pavel Emelyanov wrote: > On 11/22/2016 03:01 PM, Cyrill Gorcunov wrote: >> On Tue, Nov 22, 2016 at 02:45:46PM +0300, Pavel Emelyanov wrote: >>> I've somehow lost 1/3 and 2/3 :( What are the subjects? >> >> 1063 C Nov 21 Andrey Vagin [PATCH criu 1/3] mount: handle error from restore_shared_options() > > Cannot find one nor in my mailbox, nor on the ML archives :( Here they are: https://lists.openvz.org/pipermail/devel/2016-November/069621.html https://lists.openvz.org/pipermail/devel/2016-November/069623.html https://lists.openvz.org/pipermail/devel/2016-November/069622.html Not sure, why it's on @devel list.. > >> 1064 C Nov 21 Andrey Vagin ├─>[PATCH criu 2/3] mount: fix mounting non-root shared mounts > > This one sits in my mailbox as "[PATCH 2/2] mount: fix mounting non-root shared mounts". Is it the same? > >> 1065 C Nov 21 Andrey Vagin └─>[PATCH criu 3/3] mount: don't create a temporary directory if /tmp exists >> >> Cyrill >> . >> > > _______________________________________________ > Devel mailing list > Devel@openvz.org > https://lists.openvz.org/mailman/listinfo/devel >