All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Ring <stefanrin@gmail.com>
To: linux-xfs@vger.kernel.org
Subject: [PATCH 1/5] xfs_metadump: Extend data zapping to XFS_DIR{2,3}_LEAFN_MAGIC blocks
Date: Fri, 26 Oct 2018 22:19:39 +0200	[thread overview]
Message-ID: <20181026201943.24131-2-stefanrin@gmail.com> (raw)
In-Reply-To: <20181026201943.24131-1-stefanrin@gmail.com>

---
 db/metadump.c | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/db/metadump.c b/db/metadump.c
index cc2ae9af..97d2a490 100644
--- a/db/metadump.c
+++ b/db/metadump.c
@@ -1426,7 +1426,7 @@ process_dir_leaf_block(
 	char				*block)
 {
 	struct xfs_dir2_leaf		*leaf;
-	struct xfs_dir3_icleaf_hdr 	leafhdr;
+	struct xfs_dir3_icleaf_hdr	leafhdr;
 
 	if (!zero_stale_data)
 		return;
@@ -1435,20 +1435,39 @@ process_dir_leaf_block(
 	leaf = (struct xfs_dir2_leaf *)block;
 	M_DIROPS(mp)->leaf_hdr_from_disk(&leafhdr, leaf);
 
-	/* Zero out space from end of ents[] to bests */
-	if (leafhdr.magic == XFS_DIR2_LEAF1_MAGIC ||
-	    leafhdr.magic == XFS_DIR3_LEAF1_MAGIC) {
+	switch (leafhdr.magic) {
+	case XFS_DIR2_LEAF1_MAGIC:
+	case XFS_DIR3_LEAF1_MAGIC: {
 		struct xfs_dir2_leaf_tail	*ltp;
 		__be16				*lbp;
 		struct xfs_dir2_leaf_entry	*ents;
 		char				*free; /* end of ents */
 
+		/* Zero out space from end of ents[] to bests */
 		ents = M_DIROPS(mp)->leaf_ents_p(leaf);
 		free = (char *)&ents[leafhdr.count];
 		ltp = xfs_dir2_leaf_tail_p(mp->m_dir_geo, leaf);
 		lbp = xfs_dir2_leaf_bests_p(ltp);
 		memset(free, 0, (char *)lbp - free);
 		iocur_top->need_crc = 1;
+		break;
+	}
+	case XFS_DIR2_LEAFN_MAGIC:
+	case XFS_DIR3_LEAFN_MAGIC: {
+		struct xfs_dir2_leaf_entry	*ents;
+		char				*free;
+		int				used;
+
+		/* Zero out space from end of ents[] to end of block */
+		ents = M_DIROPS(mp)->leaf_ents_p(leaf);
+		free = (char *)&ents[leafhdr.count];
+		used = free - (char*)leaf;
+		memset(free, 0, mp->m_dir_geo->blksize - used);
+		iocur_top->need_crc = 1;
+		break;
+	}
+	default:
+		break;
 	}
 }
 
-- 
2.14.5

  reply	other threads:[~2018-10-27  4:58 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-26 20:19 [PATCH 0/5] v4 Try to squash metadump data leaks Stefan Ring
2018-10-26 20:19 ` Stefan Ring [this message]
2018-10-26 20:19 ` [PATCH 2/5] xfs_metadump: Zap multi fsb blocks Stefan Ring
2018-10-26 20:19 ` [PATCH 3/5] xfs_metadump: Zap freeindex blocks in directory inodes Stefan Ring
2018-10-26 20:19 ` [PATCH 4/5] xfs_metadump: Zap unused space in inode btrees Stefan Ring
2018-10-27  6:23   ` Stefan Ring
2018-10-26 20:19 ` [PATCH 5/5] xfs_metadump: Zap dev inodes Stefan Ring
2018-10-29 15:38   ` Eric Sandeen
2018-10-29 18:33     ` Stefan Ring
2018-10-29 18:37       ` Eric Sandeen
2018-10-29 18:45         ` Stefan Ring
2018-10-26 20:27 ` [PATCH 0/5] v4 Try to squash metadump data leaks Eric Sandeen
2018-10-26 23:33   ` Eric Sandeen
2018-10-26 23:38     ` Darrick J. Wong
2018-10-28 12:38     ` Stefan Ring
2018-10-28 14:36       ` Stefan Ring
2018-10-28 15:42         ` Stefan Ring
2018-10-28 17:13       ` Eric Sandeen
2018-10-30 12:29         ` Stefan Ring
2018-10-30 12:36           ` Eric Sandeen
2018-11-05 21:31 [PATCH v5 0/5] " 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
2019-01-07 20:13 [PATCH v6 0/5] Try to squash metadump data leaks 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

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=20181026201943.24131-2-stefanrin@gmail.com \
    --to=stefanrin@gmail.com \
    --cc=linux-xfs@vger.kernel.org \
    /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.