<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Thanks!</p>
    <p>Acked-by: Stanislav Kinsburskiy <a class="moz-txt-link-rfc2396E"
        href="mailto:skinsbursky@virtuozzo.com">&lt;skinsbursky@virtuozzo.com&gt;</a></p>
    <br>
    <div class="moz-cite-prefix">01.06.2017 14:08, Kirill Tkhai пишет:<br>
    </div>
    <blockquote
      cite="mid:3080370b-7e79-03dd-3f8d-317f45a08f6f@virtuozzo.com"
      type="cite">
      <pre wrap="">On 01.06.2017 14:34, Kirill Tkhai wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">Everything is prepared: the pair "type and id" is
uniqul, so find_file_desc() in collect_fd() will
work as expected and it will find the file_desc
we just added in autofs_create_pipe()-&gt;collect_one_pipe_ops().

So, the not-generic helper may be killed.

Signed-off-by: Kirill Tkhai <a class="moz-txt-link-rfc2396E" href="mailto:ktkhai@virtuozzo.com">&lt;ktkhai@virtuozzo.com&gt;</a>
</pre>
      </blockquote>
      <pre wrap="">
Returned debug print:

[PATCH 4/5 v2]files: Kill autofs_create_fle() and use generic helper

Everything is prepared: the pair "type and id" is
uniqul, so find_file_desc() in collect_fd() will
work as expected and it will find the file_desc
we just added in autofs_create_pipe()-&gt;collect_one_pipe_ops().

So, the not-generic helper may be killed.

v2: Leave debug print on the place.

Signed-off-by: Kirill Tkhai <a class="moz-txt-link-rfc2396E" href="mailto:ktkhai@virtuozzo.com">&lt;ktkhai@virtuozzo.com&gt;</a>
Acked-by: Stanislav Kinsburskiy <a class="moz-txt-link-rfc2396E" href="mailto:skinsbursky@virtuozzo.com">&lt;skinsbursky@virtuozzo.com&gt;</a>
---
 criu/autofs.c | 26 +++-----------------------
 1 file changed, 3 insertions(+), 23 deletions(-)

diff --git a/criu/autofs.c b/criu/autofs.c
index 9567b955d..bd64624e3 100644
--- a/criu/autofs.c
+++ b/criu/autofs.c
@@ -849,28 +849,6 @@ static struct fdinfo_list_entry *autofs_pipe_le(struct pstree_item *master,
         return ple;
 }
 
-static int autofs_create_fle(struct pstree_item *task, FdinfoEntry *fe,
-                             struct file_desc *desc)
-{
-        struct fdinfo_list_entry *le;
-        struct rst_info *rst_info = rsti(task);
-
-        le = shmalloc(sizeof(*le));
-        if (!le)
-                return -1;
-
-        fle_init(le, vpid(task), fe);
-
-        collect_task_fd(le, rst_info);
-
-        list_add_tail(&amp;le-&gt;desc_list, &amp;desc-&gt;fd_info_head);
-        le-&gt;desc = desc;
-
-        pr_info("autofs: added pipe fd %d, flags %#x to %d (with post_open)\n",
-                        le-&gt;fe-&gt;fd, le-&gt;fe-&gt;flags, le-&gt;pid);
-        return 0;
-}
-
 static int autofs_open_pipefd(struct file_desc *d, int *new_fd)
 {
         struct fdinfo_list_entry *fle = file_master(d);
@@ -925,7 +903,9 @@ static int autofs_create_pipe(struct pstree_item *task, autofs_info_t *i,
                 return -1;
         fe-&gt;type = FD_TYPES__AUTOFS_PIPE;
 
-        return autofs_create_fle(task, fe, &amp;i-&gt;pi.d);
+        pr_info("autofs: adding pipe fd %d, flags %#x to %d (with post_open)\n",
+                fe-&gt;fd, fe-&gt;flags, vpid(task));
+        return collect_fd(vpid(task), fe, rsti(task));
 }
 
 static int autofs_add_mount_info(void *data)
</pre>
    </blockquote>
    <br>
  </body>
</html>