[PATCHv2] kdat: Don't open /run/criu.kdat if doesn't exists

Submitted by Radostin Stoyanov on July 2, 2018, 8:43 p.m.

Details

Message ID 20180702204345.1981-1-rstoyanov1@gmail.com
State Accepted
Series "kdat: Don't open /run/criu.kdat if doesn't exists"
Headers show

Commit Message

Radostin Stoyanov July 2, 2018, 8:43 p.m.
When CRIU is called for a first time and the /run/criu.kdat file does
not exists, the following warning is shown:
        Warn  (criu/kerndat.c:847): Can't load /run/criu.kdat

This patch is replacing this warning with a more appropriate debug message.
        File /run/criu.kdat does not exist

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
---
 criu/kerndat.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/criu/kerndat.c b/criu/kerndat.c
index 9b93487c..8c403e18 100644
--- a/criu/kerndat.c
+++ b/criu/kerndat.c
@@ -844,7 +844,10 @@  static int kerndat_try_load_cache(void)
 
 	fd = open(KERNDAT_CACHE_FILE, O_RDONLY);
 	if (fd < 0) {
-		pr_warn("Can't load %s\n", KERNDAT_CACHE_FILE);
+		if(ENOENT == errno)
+			pr_debug("File %s does not exist\n", KERNDAT_CACHE_FILE);
+		else
+			pr_warn("Can't load %s\n", KERNDAT_CACHE_FILE);
 		return 1;
 	}
 

Comments

Andrei Vagin July 12, 2018, 9:17 p.m.
Applied, thanks

On Mon, Jul 02, 2018 at 09:43:45PM +0100, Radostin Stoyanov wrote:
> When CRIU is called for a first time and the /run/criu.kdat file does
> not exists, the following warning is shown:
>         Warn  (criu/kerndat.c:847): Can't load /run/criu.kdat
> 
> This patch is replacing this warning with a more appropriate debug message.
>         File /run/criu.kdat does not exist
> 
> Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
> ---
>  criu/kerndat.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/criu/kerndat.c b/criu/kerndat.c
> index 9b93487c..8c403e18 100644
> --- a/criu/kerndat.c
> +++ b/criu/kerndat.c
> @@ -844,7 +844,10 @@ static int kerndat_try_load_cache(void)
>  
>  	fd = open(KERNDAT_CACHE_FILE, O_RDONLY);
>  	if (fd < 0) {
> -		pr_warn("Can't load %s\n", KERNDAT_CACHE_FILE);
> +		if(ENOENT == errno)
> +			pr_debug("File %s does not exist\n", KERNDAT_CACHE_FILE);
> +		else
> +			pr_warn("Can't load %s\n", KERNDAT_CACHE_FILE);
>  		return 1;
>  	}
>  
> -- 
> 2.17.1
> 
> _______________________________________________
> CRIU mailing list
> CRIU@openvz.org
> https://lists.openvz.org/mailman/listinfo/criu