<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">&lt;<a href="mailto:avagin@odin.com" target="_blank">avagin@odin.com</a>&gt;</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>
&gt; Currently if /tmp does not exist, CRIU fails because it will not be<br>
&gt; able to create a temporary directory there.  But when checkpointing<br>
&gt; and restoring containers, we cannot rely on the existence of /tmp.<br>
&gt; For such containers, we should use root (/).  The temporary directory<br>
&gt; will be removed after CRIU is done.<br>
&gt;<br>
&gt; Signed-off-by: Saied Kazemi &lt;<a href="mailto:saied@google.com">saied@google.com</a>&gt;<br>
&gt; ---<br>
&gt;  mount.c | 9 +++++++--<br>
&gt;  1 file changed, 7 insertions(+), 2 deletions(-)<br>
&gt;<br>
&gt; diff --git a/mount.c b/mount.c<br>
&gt; index 079430a..4ae1150 100644<br>
&gt; --- a/mount.c<br>
&gt; +++ b/mount.c<br>
&gt; @@ -774,7 +774,9 @@ int open_mount(unsigned int s_dev)<br>
&gt;  static int open_mountpoint(struct mount_info *pm)<br>
&gt;  {<br>
&gt;       int fd = -1, ns_old = -1;<br>
&gt; -     char mnt_path[] = &quot;/tmp/cr-tmpfs.XXXXXX&quot;;<br>
&gt; +     char mnt_path_tmp[] = &quot;/tmp2/cr-tmpfs.XXXXXX&quot;;<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>
&gt; +     char mnt_path_root[] = &quot;/cr-tmpfs.XXXXXX&quot;;<br>
&gt; +     char *mnt_path = mnt_path_tmp;<br>
&gt;       int cwd_fd;<br>
&gt;<br>
&gt;       /*<br>
&gt; @@ -803,7 +805,10 @@ static int open_mountpoint(struct mount_info *pm)<br>
&gt;       if (switch_ns(root_item-&gt;pid.real, &amp;mnt_ns_desc, &amp;ns_old) &lt; 0)<br>
&gt;               goto out;<br>
&gt;<br>
&gt; -     if (mkdtemp(mnt_path) == NULL) {<br>
&gt; +     mnt_path = mkdtemp(mnt_path_tmp);<br>
&gt; +     if (mnt_path == NULL &amp;&amp; errno == ENOENT)<br>
&gt; +             mnt_path = mkdtemp(mnt_path_root);<br>
&gt; +     if (mnt_path == NULL) {<br>
&gt;               pr_perror(&quot;Can&#39;t create a temporary directory&quot;);<br>
&gt;               goto out;<br>
&gt;       }<br>
&gt; --<br>
&gt; 1.9.1<br></span></blockquote><div><br></div><div>--Saied</div><div> </div></div></div></div>