All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Stefan Ring <stefanrin@gmail.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 3/5] xfs_metadump: Zap freeindex blocks in directory inodes
Date: Thu, 3 Jan 2019 09:59:47 -0800	[thread overview]
Message-ID: <20190103175947.GG20475@magnolia> (raw)
In-Reply-To: <20181105213145.7560-4-stefanrin@gmail.com>

On Mon, Nov 05, 2018 at 10:31:43PM +0100, Stefan Ring wrote:
> Signed-off-by: Stefan Ring <stefanrin@gmail.com>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  db/metadump.c | 46 ++++++++++++++++++++++++++++++++++++++++------
>  1 file changed, 40 insertions(+), 6 deletions(-)
> 
> diff --git a/db/metadump.c b/db/metadump.c
> index be7cf360..d4c751c0 100644
> --- a/db/metadump.c
> +++ b/db/metadump.c
> @@ -1421,6 +1421,43 @@ process_sf_attr(
>  		memset(asfep, 0, XFS_DFORK_ASIZE(dip, mp) - ino_attr_size);
>  }
>  
> +static void
> +process_dir_free_block(
> +	char				*block)
> +{
> +	struct xfs_dir2_free		*free;
> +	struct xfs_dir3_icfree_hdr	freehdr;
> +
> +	if (!zero_stale_data)
> +		return;
> +
> +	free = (struct xfs_dir2_free *)block;
> +	M_DIROPS(mp)->free_hdr_from_disk(&freehdr, free);
> +
> +	switch (freehdr.magic) {
> +	case XFS_DIR2_FREE_MAGIC:
> +	case XFS_DIR3_FREE_MAGIC: {
> +		__be16			*bests;
> +		char			*high;
> +		int			used;
> +
> +		/* Zero out space from end of bests[] to end of block */
> +		bests = M_DIROPS(mp)->free_bests_p(free);
> +		high = (char *)&bests[freehdr.nvalid];
> +		used = high - (char*)free;
> +		memset(high, 0, mp->m_dir_geo->blksize - used);
> +		iocur_top->need_crc = 1;
> +		break;
> +	}
> +	default:
> +		if (show_warnings)
> +			print_warning("invalid magic in dir inode %llu "
> +				      "free block",
> +				      (unsigned long long)cur_ino);
> +		break;
> +	}
> +}
> +
>  static void
>  process_dir_leaf_block(
>  	char				*block)
> @@ -1518,7 +1555,7 @@ process_dir_data_block(
>  		if (show_warnings)
>  			print_warning(
>  		"invalid magic in dir inode %llu block %ld",
> -					(long long)cur_ino, (long)offset);
> +					(unsigned long long)cur_ino, (long)offset);
>  		return;
>  	}
>  
> @@ -1832,8 +1869,7 @@ process_single_fsb_objects(
>  		switch (btype) {
>  		case TYP_DIR2:
>  			if (o >= mp->m_dir_geo->freeblk) {
> -				/* TODO, zap any stale data */
> -				break;
> +				process_dir_free_block(dp);
>  			} else if (o >= mp->m_dir_geo->leafblk) {
>  				process_dir_leaf_block(dp);
>  			} else {
> @@ -1924,8 +1960,7 @@ process_multi_fsb_objects(
>  
>  			dp = iocur_top->data;
>  			if (o >= mp->m_dir_geo->freeblk) {
> -				/* TODO, zap any stale data */
> -				goto write;
> +				process_dir_free_block(dp);
>  			} else if (o >= mp->m_dir_geo->leafblk) {
>  				process_dir_leaf_block(dp);
>  			} else {
> @@ -1934,7 +1969,6 @@ process_multi_fsb_objects(
>  			}
>  
>  			iocur_top->need_crc = obfuscate || zero_stale_data;
> -write:
>  			ret = write_buf(iocur_top);
>  out_pop:
>  			pop_cur();
> -- 
> 2.14.5
> 

  reply	other threads:[~2019-01-03 17:59 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-05 21:31 [PATCH v5 0/5] Try to squash metadump data leaks Stefan Ring
2018-11-05 21:31 ` [PATCH 1/5] xfs_metadump: Extend data zapping to XFS_DIR{2,3}_LEAFN_MAGIC blocks Stefan Ring
2018-12-20 22:20   ` Eric Sandeen
2018-11-05 21:31 ` [PATCH 2/5] xfs_metadump: Zap multi fsb blocks Stefan Ring
2019-01-03 17:55   ` Darrick J. Wong
2019-01-04 22:27     ` Stefan Ring
2019-01-04 23:11       ` Eric Sandeen
2018-11-05 21:31 ` [PATCH 3/5] xfs_metadump: Zap freeindex blocks in directory inodes Stefan Ring
2019-01-03 17:59   ` Darrick J. Wong [this message]
2018-11-05 21:31 ` [PATCH 4/5] xfs_metadump: Zap unused space in inode btrees Stefan Ring
2019-01-03 17:57   ` Darrick J. Wong
2018-11-05 21:31 ` [PATCH 5/5] xfs_metadump: Zap dev inodes Stefan Ring
2019-01-03 17:57   ` Darrick J. Wong
2018-12-06 17:04 ` [PATCH v5 0/5] Try to squash metadump data leaks Stefan Ring
2018-12-06 20:23   ` Eric Sandeen
2019-01-07 20:13 ` [PATCH v6 " Stefan Ring
2019-01-07 20:13   ` [PATCH 1/5] xfs_metadump: Extend data zapping to XFS_DIR{2,3}_LEAFN_MAGIC blocks Stefan Ring
2019-01-07 20:13   ` [PATCH 2/5] xfs_metadump: Zap multi fsb blocks Stefan Ring
2019-01-11 17:31     ` Eric Sandeen
2019-01-14 17:42       ` Stefan Ring
2019-01-14 17:46         ` Eric Sandeen
2019-01-07 20:13   ` [PATCH 3/5] xfs_metadump: Zap freeindex blocks in directory inodes Stefan Ring
2019-01-07 20:13   ` [PATCH 4/5] xfs_metadump: Zap unused space in inode btrees Stefan Ring
2019-01-07 20:13   ` [PATCH 5/5] xfs_metadump: Zap dev inodes Stefan Ring
  -- strict thread matches above, loose matches on Subject: below --
2018-10-26 20:19 [PATCH 0/5] v4 Try to squash metadump data leaks Stefan Ring
2018-10-26 20:19 ` [PATCH 3/5] xfs_metadump: Zap freeindex blocks in directory inodes Stefan Ring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190103175947.GG20475@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=stefanrin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.