autofs: collect new pipe fd as used

Submitted by Stanislav Kinsburskiy on April 27, 2016, 1:33 p.m.

Details

Message ID 20160427133304.17496.55126.stgit@skinsbursky-vz7.qa.sw.ru
State Accepted
Series "autofs: collect new pipe fd as used"
Commit 4e3ef6d442f3ce8997e6264b271a72b1da41cdb4
Headers show

Commit Message

Stanislav Kinsburskiy April 27, 2016, 1:33 p.m.
This is essential to make sure, that we won't use the same pipe descriptor for
different pipes.
Otherwise we can run into problem with fd send via unix sockets.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
---
 criu/autofs.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/criu/autofs.c b/criu/autofs.c
index 069f67b..7669c1f 100644
--- a/criu/autofs.c
+++ b/criu/autofs.c
@@ -694,6 +694,7 @@  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) + sizeof(int));
 	if (!le)
@@ -704,7 +705,9 @@  static int autofs_create_fle(struct pstree_item *task, FdinfoEntry *fe,
 	le->pid = task->pid.virt;
 	le->fe = fe;
 
-	collect_gen_fd(le, rsti(task));
+	collect_gen_fd(le, rst_info);
+
+	collect_used_fd(le, rst_info);
 
 	list_add_tail(&le->desc_list, &desc->fd_info_head);
 	le->desc = desc;

Comments

Cyrill Gorcunov April 27, 2016, 2:05 p.m.
On Wed, Apr 27, 2016 at 04:33:06PM +0300, Stanislav Kinsburskiy wrote:
> This is essential to make sure, that we won't use the same pipe descriptor for
> different pipes.
> Otherwise we can run into problem with fd send via unix sockets.
> 
> Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Tested-by: Cyrill Gorcunov <gorcunov@openvz.org>
Pavel Emelianov May 4, 2016, 7:14 a.m.
Applied