Skip to content
Commit c4cf5f0b authored by Evgenii Shatokhin's avatar Evgenii Shatokhin Committed by Pavel Emelyanov
Browse files

dump: check for conflicts with the dead processes



It may happen that a process has completed but its files in /proc/PID/
are still open by another process (see remap_dead_pid test from zdtm
suite, for example).

If the PID number has been given to some newer thread since then, this
can be problematic. If that thread is the main thread of some process,
it seems to be handled OK on restore. However, if it is a secondary
thread, restore fails with an error like:

  pie: Error (pie/restorer.c:439): Thread pid mismatch 4404/4403

This is because open_remap_dead_process() adds a helper with PID 4403 to
restore /proc/4403/* and that clashes with the thread's PID.

It seems reasonable to detect such things at the checkpoint stage and
refuse to dump, rather than to fail during restore.

v.3:
* Loop over dead_pids[] first: the array is likely to be empty.
  Note that it is still needed to iterate over the threads explicitly
  because pstree contains no items for the threads at that point.

v.2:
* Check for conflicts after all tasks have been dumped. One cannot rely
  on any particular order of tasks being dumped.

Signed-off-by: default avatarEvgenii Shatokhin <eshatokhin@virtuozzo.com>
Signed-off-by: default avatarPavel Emelyanov <xemul@virtuozzo.com>
parent e12ccb95
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment