[CRIU] [PATCH RFC 00/30] Rework file opening scheme to make it asynchronous

Kirill Tkhai ktkhai at virtuozzo.com
Wed Nov 2 04:31:24 PDT 2016


The scheme of this patch set is below. Note, than tests are working
after every patch except [29/30]files: Make recv_fd_from_peer() non-block.
To make it working too, it's need to merge it with 30/30, but the result
patch becomes too big. So, they are separate.

1)[2/30]Create per-process transport socket. Nobody uses it for now

2)[3/30]Add new task_st futex and use it to report task creation status:
  TASK_ALLOCATED, TFD_INSTALLED (transport fd is installed).

  Wait on task_st till TFD_INSTALLED before sending a fd to peer.
  Note, that we still send to per-fd transport socket. It's just
  a preparation.

3)[4/30]Allow to send and receive fle pointer together with fd. Unused
  for now.

4)[5/30]Change recv_fd() to recv_fd_from_peer() to receive fd with fles.
  Unused for now. The only thing we use, is to check, that we received
  expected fle.

5)Then, "[9/30]files: Allow to receive further fds" prepares recv_fd_from_peer(* fle)
  for receiving not only expected fle. If received a future fle, not
  the fle, we need at this moment of restore (argument of function),
  it's just queued to appropriate place, and we continue to wait the fle.
  Note, that this moment nobody send wrong fle, but everything is prepared for that.

6)So, in "[10/30]files: Make sending fds to peers async" we kill per-fd transport sockets
  and become to use per-process sock. Everything was prepared before for that.

7)In further, "[16/30]files: Kill fd_open_state::receive_fd stage" kills receive stage.
  It was need for slave fds (i.e. !file_masters()), and there are no post_open who
  depends on it. Also, receiving fd is async. So, safely move it to post_open_fd().

8)"[18/30]files: Implement {set,get}_fds_event()" implements wait/wake in try_to_wake_up() way.

9)"[19/30]files: Add fdinfo_list_entry::stage" introduces stages of opening a file descriptor
  and sets them.

10)[20-23/30]Further we allow unix sockets and sk-inet sockets to use global task_st futex
   instead of their local ones for synchronization.

11)[27/30]In "files: Set fds event after sending fd to peer" we notify fle's owner by task_st
   that new incomming fd is received. Unused for now, nobody needs that yet.

12)"[29/30]files: Make recv_fd_from_peer() non-block" allows to do not block on receiving a fd.
   We are going to block on task_st in further patches, so kill this blocking place.
   This patch breaks tests, but next patch fixes everything.

   "[30/30]files: Kill struct file_desc_ops::post_open" kills open scheme and replaces it with
   async call of callbacks.


More information about the CRIU mailing list