2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 05:18:00 +00:00

files: Do not close PROC_PID_FD_OFF sfd in prepare_fds()

Here we need to close proc self fd only, as it's not
a service fd, and it can occupy real task fd number.
Closing of PROC_PID_FD_OFF is useless action here,
because it's already occupy a service fd number.

So, we skip this excess syscall, and leave PROC_PID_FD_OFF
open.

v4: New

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
This commit is contained in:
Kirill Tkhai 2018-01-10 17:00:48 +03:00 committed by Andrei Vagin
parent d5bece6678
commit eea17eba89
3 changed files with 3 additions and 2 deletions

View File

@ -1297,7 +1297,7 @@ int prepare_fds(struct pstree_item *me)
* set than its parent
*/
close_service_fd(CGROUP_YARD);
close_pid_proc(); /* flush any proc cached fds we may have */
set_proc_self_fd(-1); /* flush any proc cached fds we may have */
if (rsti(me)->fdt) {
struct fdt *fdt = rsti(me)->fdt;

View File

@ -28,6 +28,7 @@ enum sfd_type {
struct pstree_item;
extern void set_proc_self_fd(int fd);
extern int clone_service_fd(int id);
extern int init_service_fd(void);
extern int get_service_fd(enum sfd_type type);

View File

@ -296,7 +296,7 @@ static pid_t open_proc_pid = PROC_NONE;
static pid_t open_proc_self_pid;
static int open_proc_self_fd = -1;
static inline void set_proc_self_fd(int fd)
void set_proc_self_fd(int fd)
{
if (open_proc_self_fd >= 0)
close(open_proc_self_fd);