[CRIU] [PATCH 2/2] pagemap: Fault inject partial pages.img read

Mike Rapoport rppt at linux.vnet.ibm.com
Mon Feb 6 03:46:07 PST 2017


On Mon, Feb 06, 2017 at 01:24:18PM +0300, Pavel Emelyanov wrote:
> On 02/05/2017 03:18 PM, Mike Rapoport wrote:
> > On Fri, Feb 03, 2017 at 04:23:17PM +0300, Pavel Emelyanov wrote:
> >>
> >> Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
> >>
> >> ---
> >>  criu/include/fault-injection.h |  1 +
> >>  criu/pagemap.c                 | 13 +++++++++++++
> >>  test/jenkins/criu-fault.sh     |  2 ++
> >>  3 files changed, 16 insertions(+)
> >>
> >> diff --git a/criu/include/fault-injection.h b/criu/include/fault-injection.h
> >> index cf9859c..2b23f54 100644
> >> --- a/criu/include/fault-injection.h
> >> +++ b/criu/include/fault-injection.h
> >> @@ -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,
> >>  };
> >>
> >> diff --git a/criu/pagemap.c b/criu/pagemap.c
> >> index cb4c990..1fc9ba7 100644
> >> --- a/criu/pagemap.c
> >> +++ b/criu/pagemap.c
> >> @@ -12,6 +12,7 @@
> >>  #include "pagemap.h"
> >>  #include "page-xfer.h"
> >>
> >> +#include "fault-injection.h"
> >>  #include "xmalloc.h"
> >>  #include "protobuf.h"
> >>  #include "images/pagemap.pb-c.h"
> >> @@ -494,6 +495,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;
> >> +			}
> >> +		}
> >> +
> > 
> > Maybe wrap pread + fault injection to pread_with_fault?
> 
> Hm... And use it everywhere we _know_ re-read is OK. Good idea :) Do you know any
> other place that deserves this?
 
Not really... In page-read we preadv only here

git grep preadv? ;-)

> > 
> >>  		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",
> >> diff --git a/test/jenkins/criu-fault.sh b/test/jenkins/criu-fault.sh
> >> index ab6c6c7..7ed2680 100755
> >> --- a/test/jenkins/criu-fault.sh
> >> +++ b/test/jenkins/criu-fault.sh
> >> @@ -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
> >> -- 
> >> 2.1.4
> >>
> >> _______________________________________________
> >> CRIU mailing list
> >> CRIU at openvz.org
> >> https://lists.openvz.org/mailman/listinfo/criu
> >>
> > 
> > .
> > 
> 



More information about the CRIU mailing list