mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 06:15:24 +00:00
flock: blocked processes are not interesting for us (v2)
All out processes are stopped in a moment, when file locks are collected, so they can't to wait any locks. Here is a proof of this theory: [root@avagin-fc19-cr ~]# flock xxx sleep 1000 & [1] 23278 [root@avagin-fc19-cr ~]# flock xxx sleep 1000 & [2] 23280 [root@avagin-fc19-cr ~]# cat /proc/locks 1: FLOCK ADVISORY WRITE 23278 08:03:280001 0 EOF 1: -> FLOCK ADVISORY WRITE 23280 08:03:280001 0 EOF [root@avagin-fc19-cr ~]# gdb -p 23280 (gdb) ^Z [3]+ Stopped gdb -p 23280 [root@avagin-fc19-cr ~]# cat /proc/locks 1: FLOCK ADVISORY WRITE 23278 08:03:280001 0 EOF Currently criu can dump nothing, if we have one process which is waiting a lock. I don't see any reason to do this. v2: typo fix Cc: Qiang Huang <h.huangqiang@huawei.com> Reported-by: Mr Jenkins Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
391269b58f
commit
fc84aa581a
36
proc_parse.c
36
proc_parse.c
@@ -1536,6 +1536,12 @@ int parse_file_locks(void)
|
||||
goto err;
|
||||
}
|
||||
|
||||
pr_info("lockinfo: %lld:%d %x %d %02x:%02x:%ld %lld %s\n",
|
||||
fl->fl_id, fl->fl_kind, fl->fl_ltype,
|
||||
fl->fl_owner, fl->maj, fl->min, fl->i_no,
|
||||
fl->start, fl->end);
|
||||
|
||||
|
||||
if (fl->fl_kind == FL_UNKNOWN) {
|
||||
pr_err("Unknown file lock!\n");
|
||||
ret = -1;
|
||||
@@ -1543,6 +1549,16 @@ int parse_file_locks(void)
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (is_blocked) {
|
||||
/*
|
||||
* All target processes are stopped in this moment and
|
||||
* can't wait any locks.
|
||||
*/
|
||||
pr_debug("Skip blocked processes\n");
|
||||
xfree(fl);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((fl->fl_kind == FL_POSIX) &&
|
||||
!pid_in_pstree(fl->fl_owner)) {
|
||||
/*
|
||||
@@ -1554,26 +1570,6 @@ int parse_file_locks(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
pr_info("lockinfo: %lld:%d %x %d %02x:%02x:%ld %lld %s\n",
|
||||
fl->fl_id, fl->fl_kind, fl->fl_ltype,
|
||||
fl->fl_owner, fl->maj, fl->min, fl->i_no,
|
||||
fl->start, fl->end);
|
||||
|
||||
if (is_blocked) {
|
||||
/*
|
||||
* Here the task is in the pstree.
|
||||
* If it is blocked on a flock, when we try to
|
||||
* ptrace-seize it, the kernel will unblock task
|
||||
* from flock and will stop it in another place.
|
||||
* So in dumping, a blocked file lock should never
|
||||
* be here.
|
||||
*/
|
||||
pr_perror("We have a blocked file lock!");
|
||||
ret = -1;
|
||||
xfree(fl);
|
||||
goto err;
|
||||
}
|
||||
|
||||
list_add_tail(&fl->list, &file_lock_list);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user