[CRIU] [PATCH 5/7] fault: add ability to fault open_by_handel in check_open_handle

Pavel Emelyanov xemul at virtuozzo.com
Wed Mar 9 04:31:24 PST 2016


On 03/08/2016 09:44 PM, Andrey Vagin wrote:
> From: Andrei Vagin <avagin at openvz.org>

What for?

> Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
> ---
>  criu/fsnotify.c                | 7 +++++++
>  criu/include/fault-injection.h | 1 +
>  2 files changed, 8 insertions(+)
> 
> diff --git a/criu/fsnotify.c b/criu/fsnotify.c
> index f633b40..abc6ba3 100644
> --- a/criu/fsnotify.c
> +++ b/criu/fsnotify.c
> @@ -40,6 +40,7 @@
>  #include "cr_options.h"
>  #include "namespaces.h"
>  #include "pstree.h"
> +#include "fault-injection.h"
>  
>  #include "protobuf.h"
>  #include "images/fsnotify.pb-c.h"
> @@ -225,7 +226,13 @@ int check_open_handle(unsigned int s_dev, unsigned long i_ino,
>  	int fd = -1;
>  	char *path;
>  
> +	if (fault_injected(FI_IRMAP)) {
> +		fd = -1;
> +		goto fault;
> +	}
> +
>  	fd = open_handle(s_dev, i_ino, f_handle);
> +fault:
>  	if (fd >= 0) {
>  		struct mount_info *mi;
>  
> diff --git a/criu/include/fault-injection.h b/criu/include/fault-injection.h
> index 989f654..034afe1 100644
> --- a/criu/include/fault-injection.h
> +++ b/criu/include/fault-injection.h
> @@ -6,6 +6,7 @@ enum faults {
>  	FI_NONE = 0,
>  	FI_DUMP_EARLY,
>  	FI_RESTORE_ROOT_ONLY,
> +	FI_IRMAP,
>  	FI_MAX,
>  };
>  
> 



More information about the CRIU mailing list