Commit 649280e3 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Andrei Vagin

pagemap: Fault inject partial pages.img read

Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 0d979b29
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment