xfs
[Top] [All Lists]

Re: [PATCH 4/4 V3] xfsprogs: zero out clean log in xfs_metadump

To: Eric Sandeen <sandeen@xxxxxxxxxxx>
Subject: Re: [PATCH 4/4 V3] xfsprogs: zero out clean log in xfs_metadump
From: Brian Foster <bfoster@xxxxxxxxxx>
Date: Mon, 8 Jun 2015 14:50:55 -0400
Cc: Eric Sandeen <sandeen@xxxxxxxxxx>, xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <5575E30D.80800@xxxxxxxxxxx>
References: <5568B7CE.9030709@xxxxxxxxxx> <5568BB5C.4080400@xxxxxxxxxxx> <5575AF7A.8050306@xxxxxxxxxxx> <5575E30D.80800@xxxxxxxxxxx>
User-agent: Mutt/1.5.23 (2014-03-12)
On Mon, Jun 08, 2015 at 01:46:37PM -0500, Eric Sandeen wrote:
> When doing an obfuscated xfs_metadump, if the log is clean, zero
> it out for 2 reasons:
> 
>  * It'll make the image more compressible
>  * It'll eliminate an un-obfuscated metadata source
> 
> If the log isn't clean, and the user expected obfuscation, warn
> that metadata in the log will not be obfuscated.
> 
> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
> ---
> 
> V2: If not obfuscating, copy log as-is
> V3: Remove pointless "obfuscate" checks after goto
> 

Looks good to me:

Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx>

> diff --git a/db/metadump.c b/db/metadump.c
> index bea4e00..bdc48a0 100644
> --- a/db/metadump.c
> +++ b/db/metadump.c
> @@ -17,6 +17,7 @@
>   */
>  
>  #include <libxfs.h>
> +#include <libxlog.h>
>  #include "bmap.h"
>  #include "command.h"
>  #include "metadump.h"
> @@ -2169,6 +2170,8 @@ copy_sb_inodes(void)
>  static int
>  copy_log(void)
>  {
> +     int dirty;
> +
>       if (show_progress)
>               print_progress("Copying log");
>  
> @@ -2180,6 +2183,34 @@ copy_log(void)
>               print_warning("cannot read log");
>               return !stop_on_read_error;
>       }
> +
> +     /* If not obfuscating, just copy the log as it is */
> +     if (!obfuscate)
> +             goto done;
> +
> +     dirty = xlog_is_dirty(mp, &x, 0);
> +
> +     switch (dirty) {
> +     case 0:
> +             /* clear out a clean log */
> +             if (show_progress)
> +                     print_progress("Zeroing clean log");
> +             memset(iocur_top->data, 0,
> +                     mp->m_sb.sb_logblocks * mp->m_sb.sb_blocksize);
> +             break;
> +     case 1:
> +             /* keep the dirty log */
> +             print_warning(
> +_("Filesystem log is dirty; image will contain unobfuscated metadata in 
> log."));
> +             break;
> +     case -1:
> +             /* log detection error */
> +             print_warning(
> +_("Could not discern log; image will contain unobfuscated metadata in 
> log."));
> +             break;
> +     }
> +
> +done:
>       return !write_buf(iocur_top);
>  }
>  
> 
> _______________________________________________
> xfs mailing list
> xfs@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs

<Prev in Thread] Current Thread [Next in Thread>