public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: xfs@oss.sgi.com
Subject: [PATCH 1/3] metadump: contiguous metadata object need to be split
Date: Fri, 28 Feb 2014 17:25:21 +1100	[thread overview]
Message-ID: <1393568723-982-2-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1393568723-982-1-git-send-email-david@fromorbit.com>

From: Dave Chinner <dchinner@redhat.com>

On crc enabled filesystems with obfuscation enabled we need to be
able to recalculate the CRCs on individual buffers.
process_single_fsb_objects() reads a contiguous range of single
block objects as a singel buffer, and hence we cannot correctly
recalculate the CRCs on them.

Split the loop up into individual buffer reads, processing and
writes rather than a single read, multiple block processing and a
single write.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 db/metadump.c | 46 ++++++++++++++++++++++++----------------------
 1 file changed, 24 insertions(+), 22 deletions(-)

diff --git a/db/metadump.c b/db/metadump.c
index 5baf83d..14902a7 100644
--- a/db/metadump.c
+++ b/db/metadump.c
@@ -1331,29 +1331,27 @@ process_single_fsb_objects(
 	int		ret = 0;
 	int		i;
 
-	push_cur();
-	set_cur(&typtab[btype], XFS_FSB_TO_DADDR(mp, s), c * blkbb,
-			DB_RING_IGN, NULL);
+	for (i = 0; i < c; i++) {
+		push_cur();
+		set_cur(&typtab[btype], XFS_FSB_TO_DADDR(mp, s), blkbb,
+				DB_RING_IGN, NULL);
 
-	if (!iocur_top->data) {
-		xfs_agnumber_t	agno = XFS_FSB_TO_AGNO(mp, s);
-		xfs_agblock_t	agbno = XFS_FSB_TO_AGBNO(mp, s);
+		if (!iocur_top->data) {
+			xfs_agnumber_t	agno = XFS_FSB_TO_AGNO(mp, s);
+			xfs_agblock_t	agbno = XFS_FSB_TO_AGBNO(mp, s);
 
-		print_warning("cannot read %s block %u/%u (%llu)",
-				typtab[btype].name, agno, agbno, s);
-		if (stop_on_read_error)
-			ret = -EIO;
-		goto out_pop;
+			print_warning("cannot read %s block %u/%u (%llu)",
+					typtab[btype].name, agno, agbno, s);
+			if (stop_on_read_error)
+				ret = -EIO;
+			goto out_pop;
 
-	}
+		}
 
-	if (dont_obfuscate) {
-		ret = write_buf(iocur_top);
-		goto out_pop;
-	}
+		if (dont_obfuscate)
+			goto write;
 
-	dp = iocur_top->data;
-	for (i = 0; i < c; i++) {
+		dp = iocur_top->data;
 		switch (btype) {
 		case TYP_DIR2:
 			if (o >= mp->m_dirleafblk)
@@ -1371,13 +1369,17 @@ process_single_fsb_objects(
 		default:
 			break;
 		}
+
+write:
+		ret = write_buf(iocur_top);
+out_pop:
+		pop_cur();
+		if (ret)
+			break;
 		o++;
-		dp += mp->m_sb.sb_blocksize;
+		s++;
 	}
-	ret = write_buf(iocur_top);
 
-out_pop:
-	pop_cur();
 	return ret;
 }
 
-- 
1.9.0

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2014-02-28  6:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-28  6:25 [PATCH 0/3] metadump: fixes for obfuscated dumps Dave Chinner
2014-02-28  6:25 ` Dave Chinner [this message]
2014-02-28 17:52   ` [PATCH 1/3] metadump: contiguous metadata object need to be split Eric Sandeen
2014-02-28  6:25 ` [PATCH 2/3] metadump: Only verify obfuscated metadata being dumped Dave Chinner
2014-02-28 17:58   ` Eric Sandeen
2014-02-28  6:25 ` [PATCH 3/3] metadump: pathname obfuscation overruns symlink buffer Dave Chinner
2014-02-28 17:44   ` Eric Sandeen
2014-02-28 23:28     ` Dave Chinner

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=1393568723-982-2-git-send-email-david@fromorbit.com \
    --to=david@fromorbit.com \
    --cc=xfs@oss.sgi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox