<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 6, 2015 at 7:12 AM, Andrew Vagin <span dir="ltr"><<a href="mailto:avagin@odin.com" target="_blank">avagin@odin.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Fri, Apr 03, 2015 at 06:02:56PM -0700, Saied Kazemi wrote:<br>
> Currently if /tmp does not exist, CRIU fails because it will not be<br>
> able to create a temporary directory there. But when checkpointing<br>
> and restoring containers, we cannot rely on the existence of /tmp.<br>
> For such containers, we should use root (/). The temporary directory<br>
> will be removed after CRIU is done.<br>
><br>
> Signed-off-by: Saied Kazemi <<a href="mailto:saied@google.com">saied@google.com</a>><br>
> ---<br>
> mount.c | 9 +++++++--<br>
> 1 file changed, 7 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/mount.c b/mount.c<br>
> index 079430a..4ae1150 100644<br>
> --- a/mount.c<br>
> +++ b/mount.c<br>
> @@ -774,7 +774,9 @@ int open_mount(unsigned int s_dev)<br>
> static int open_mountpoint(struct mount_info *pm)<br>
> {<br>
> int fd = -1, ns_old = -1;<br>
> - char mnt_path[] = "/tmp/cr-tmpfs.XXXXXX";<br>
> + char mnt_path_tmp[] = "/tmp2/cr-tmpfs.XXXXXX";<br>
<br>
</span>s/tmp2/tmp ?<br></blockquote><div><br></div><div>Oops. I was trying different failure scenarios and forgot to revert back to tmp. Will send a new patch.</div><div><br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
> + char mnt_path_root[] = "/cr-tmpfs.XXXXXX";<br>
> + char *mnt_path = mnt_path_tmp;<br>
> int cwd_fd;<br>
><br>
> /*<br>
> @@ -803,7 +805,10 @@ static int open_mountpoint(struct mount_info *pm)<br>
> if (switch_ns(root_item->pid.real, &mnt_ns_desc, &ns_old) < 0)<br>
> goto out;<br>
><br>
> - if (mkdtemp(mnt_path) == NULL) {<br>
> + mnt_path = mkdtemp(mnt_path_tmp);<br>
> + if (mnt_path == NULL && errno == ENOENT)<br>
> + mnt_path = mkdtemp(mnt_path_root);<br>
> + if (mnt_path == NULL) {<br>
> pr_perror("Can't create a temporary directory");<br>
> goto out;<br>
> }<br>
> --<br>
> 1.9.1<br></span></blockquote><div><br></div><div>--Saied</div><div> </div></div></div></div>