mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-17 16:47:50 +00:00
pagemap: Fault inject partial pages.img read
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
parent
0d979b2934
commit
649280e31d
3 changed files with 16 additions and 0 deletions
|
|
@ -14,6 +14,7 @@ enum faults {
|
|||
FI_CHECK_OPEN_HANDLE = 128,
|
||||
FI_NO_MEMFD = 129,
|
||||
FI_NO_BREAKPOINTS = 130,
|
||||
FI_PARTIAL_PAGES = 131,
|
||||
FI_MAX,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include "servicefd.h"
|
||||
#include "pagemap.h"
|
||||
|
||||
#include "fault-injection.h"
|
||||
#include "xmalloc.h"
|
||||
#include "protobuf.h"
|
||||
#include "images/pagemap.pb-c.h"
|
||||
|
|
@ -438,6 +439,18 @@ static int process_async_reads(struct page_read *pr)
|
|||
piov->to->iov_base, piov->to->iov_len);
|
||||
more:
|
||||
ret = preadv(fd, piov->to, piov->nr, piov->from);
|
||||
if (fault_injected(FI_PARTIAL_PAGES)) {
|
||||
/*
|
||||
* We might have read everything, but for debug
|
||||
* purposes let's try to force the advance_piov()
|
||||
* and re-read tail.
|
||||
*/
|
||||
if (ret > 0 && piov->nr >= 2) {
|
||||
pr_debug("`- trim preadv %zu\n", ret);
|
||||
ret /= 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret != piov->end - piov->from) {
|
||||
if (ret < 0) {
|
||||
pr_err("Can't read async pr bytes (%zd / %ju read, %ju off, %d iovs)\n",
|
||||
|
|
|
|||
|
|
@ -18,3 +18,5 @@ prep
|
|||
./test/zdtm.py run -t zdtm/static/unlink_fstat03 --fault 6 --report report || fail
|
||||
|
||||
./test/zdtm.py run -t zdtm/static/env00 --fault 5 --keep-going --report report || fail
|
||||
./test/zdtm.py run -t zdtm/static/maps04 --fault 131 --keep-going --report report --pre 2:1 || fail
|
||||
./test/zdtm.py run -t zdtm/transition/maps008 --fault 131 --keep-going --report report --pre 2:1 || fail
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue