All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: Peter Watkins <treestem@gmail.com>
Cc: xfs@oss.sgi.com
Subject: Re: xfs_db: bug in bmap command?
Date: Thu, 02 Aug 2012 17:19:29 -0500	[thread overview]
Message-ID: <501AFCF1.70804@sandeen.net> (raw)
In-Reply-To: <CAH4wwdGbecJ42ONkk3WQRhqUuLUALaSHP-+Ran0Lu8aofW5M8A@mail.gmail.com>

On 8/1/12 10:17 AM, Peter Watkins wrote:
> Hello,
> 
> If you have a moment would you be kind enough to review the test case
> and patch below?
> 
> I ran into this while using xfs_db to dump extents for a large,
> fragmented file. The extents were stored in btree form.

The xfs_db change looks right.  Way back when, commit
b3563c19992d0453db1826ffdbf0be6039998023 did this:

@@ -91,29 +91,27 @@ bmap(
                bno = NULLFSBLOCK;
                rblock = (xfs_bmdr_block_t *)XFS_DFORK_PTR(dip, whichfork);
                fsize = XFS_DFORK_SIZE(dip, mp, whichfork);
-               pp = XFS_BTREE_PTR_ADDR(xfs_bmdr, rblock, 1,
-                       XFS_BTREE_BLOCK_MAXRECS(fsize, xfs_bmdr, 0));
-               kp = XFS_BTREE_KEY_ADDR(xfs_bmdr, rblock, 1);
+               pp = XFS_BMDR_PTR_ADDR(rblock, 1, xfs_bmdr_maxrecs(mp, fsize, 0));
+               kp = XFS_BMDR_KEY_ADDR(rblock, 1);
                bno = select_child(curoffset, kp, pp, 
                                        be16_to_cpu(rblock->bb_numrecs));
                for (;;) {
                        set_cur(&typtab[typ], XFS_FSB_TO_DADDR(mp, bno),
                                blkbb, DB_RING_IGN, NULL);
-                       block = (xfs_bmbt_block_t *)iocur_top->data;
+                       block = (struct xfs_btree_block *)iocur_top->data;
                        if (be16_to_cpu(block->bb_level) == 0)
                                break;
-                       pp = XFS_BTREE_PTR_ADDR(xfs_bmbt, block, 1,
-                               XFS_BTREE_BLOCK_MAXRECS(mp->m_sb.sb_blocksize,
-                                       xfs_bmbt, 0));
-                       kp = XFS_BTREE_KEY_ADDR(xfs_bmbt, block, 1);
+                       pp = XFS_BMDR_PTR_ADDR(block, 1,
+                               xfs_bmbt_maxrecs(mp, mp->m_sb.sb_blocksize, 0));
+                       kp = XFS_BMDR_KEY_ADDR(block, 1);


as part of a kernel<->userspace syncup.  But you can see that some "bmdt's"
turned into "bmdr's" along the way.  Surprised that hasn't been found sooner!

I wonder if there's a way to make to make a testcase which a) doesn't require
256k of "good" output, and b) more robust to failure (a timeout & kill might
let it proceed...)

-Eric

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

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

  reply	other threads:[~2012-08-02 22:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-01 15:17 xfs_db: bug in bmap command? Peter Watkins
2012-08-02 22:19 ` Eric Sandeen [this message]
2012-08-02 22:26   ` Eric Sandeen
2012-08-02 23:31     ` Dave Chinner
2012-08-02 23:30 ` Dave Chinner
2012-08-03  2:37   ` 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=501AFCF1.70804@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=treestem@gmail.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 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.