linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH] xfs_repair: fix off by one error when rebuilding high keys
Date: Thu, 3 Jan 2019 21:49:46 -0600	[thread overview]
Message-ID: <f7cf633a-6771-3d04-f963-f88f6807752a@redhat.com> (raw)
In-Reply-To: <20190103223333.GI20475@magnolia>

On 1/3/19 4:33 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Fix an off-by-one error when scanning a rmap btree block for high keys
> as part of rebuilding rmap btrees during phase 5.  This causes
> xfs_repair to emit a corrupt filesystem, which is bad.
> 
> This can be reproduced pretty easily by exporting
> TEST_XFS_REPAIR_REBUILD=1 and running generic/051 with a 1k block size.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

changing the weird 1-indexing does sound like a good idea tho.

> ---
>  repair/phase5.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/repair/phase5.c b/repair/phase5.c
> index 85d1f4fb..1bacfc7f 100644
> --- a/repair/phase5.c
> +++ b/repair/phase5.c
> @@ -1500,7 +1500,7 @@ prop_rmap_highkey(
>  		bt_key->rm_offset = cpu_to_be64(
>  				libxfs_rmap_irec_offset_pack(&high_key));
>  
> -		for (i = 1; i < numrecs - 1; i++) {
> +		for (i = 1; i <= numrecs; i++) {
>  			bt_key = XFS_RMAP_HIGH_KEY_ADDR(bt_hdr, i);
>  			key.rm_startblock = be32_to_cpu(bt_key->rm_startblock);
>  			key.rm_owner = be64_to_cpu(bt_key->rm_owner);
> 

      parent reply	other threads:[~2019-01-04  3:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-03 22:33 [PATCH] xfs_repair: fix off by one error when rebuilding high keys Darrick J. Wong
2019-01-04  3:04 ` Eric Sandeen
2019-01-04  3:49 ` Eric Sandeen [this message]

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=f7cf633a-6771-3d04-f963-f88f6807752a@redhat.com \
    --to=sandeen@redhat.com \
    --cc=darrick.wong@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).