diff mbox

xfs_copy: accept CRC version of ABTB_MAGIC in ASSERT

Message ID 9c888b88-b664-730c-a1ff-50ee438714dd@redhat.com (mailing list archive)
State Accepted
Headers show

Commit Message

Eric Sandeen Jan. 23, 2018, 10:59 p.m. UTC
Not sure how this was missed for so long, but to handle CRC
filesystems, this ASSERT on block magic must accept CRC magic
as well.

Reported-by: Radek Burkat <radek@pinkbike.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

(yes, it's > 80 cols but .. so is most of this indented 
code block o_O)


--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Darrick J. Wong Jan. 23, 2018, 11:15 p.m. UTC | #1
On Tue, Jan 23, 2018 at 04:59:52PM -0600, Eric Sandeen wrote:
> Not sure how this was missed for so long, but to handle CRC
> filesystems, this ASSERT on block magic must accept CRC magic
> as well.
> 
> Reported-by: Radek Burkat <radek@pinkbike.com>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

I was /about/ to squawk about 'just use the allocbt verifier' but then
remembered that we don't use the xfs_buf infrastructure...

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

> ---
> 
> (yes, it's > 80 cols but .. so is most of this indented 
> code block o_O)
> 
> diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
> index fb37375..16ee4d9 100644
> --- a/copy/xfs_copy.c
> +++ b/copy/xfs_copy.c
> @@ -1140,7 +1140,8 @@ main(int argc, char **argv)
>  				 ((char *) btree_buf.data +
>  				  pos - btree_buf.position);
>  
> -			ASSERT(be32_to_cpu(block->bb_magic) == XFS_ABTB_MAGIC);
> +			ASSERT(be32_to_cpu(block->bb_magic) == XFS_ABTB_MAGIC ||
> +			       be32_to_cpu(block->bb_magic) == XFS_ABTB_CRC_MAGIC);
>  		}
>  
>  		/*
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bill O'Donnell Jan. 23, 2018, 11:35 p.m. UTC | #2
On Tue, Jan 23, 2018 at 04:59:52PM -0600, Eric Sandeen wrote:
> Not sure how this was missed for so long, but to handle CRC
> filesystems, this ASSERT on block magic must accept CRC magic
> as well.
> 
> Reported-by: Radek Burkat <radek@pinkbike.com>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Reviewed-by: Bill O'Donnell <billodo@redhat.com>

> ---
> 
> (yes, it's > 80 cols but .. so is most of this indented 
> code block o_O)
> 
> diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
> index fb37375..16ee4d9 100644
> --- a/copy/xfs_copy.c
> +++ b/copy/xfs_copy.c
> @@ -1140,7 +1140,8 @@ main(int argc, char **argv)
>  				 ((char *) btree_buf.data +
>  				  pos - btree_buf.position);
>  
> -			ASSERT(be32_to_cpu(block->bb_magic) == XFS_ABTB_MAGIC);
> +			ASSERT(be32_to_cpu(block->bb_magic) == XFS_ABTB_MAGIC ||
> +			       be32_to_cpu(block->bb_magic) == XFS_ABTB_CRC_MAGIC);
>  		}
>  
>  		/*
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index fb37375..16ee4d9 100644
--- a/copy/xfs_copy.c
+++ b/copy/xfs_copy.c
@@ -1140,7 +1140,8 @@  main(int argc, char **argv)
 				 ((char *) btree_buf.data +
 				  pos - btree_buf.position);
 
-			ASSERT(be32_to_cpu(block->bb_magic) == XFS_ABTB_MAGIC);
+			ASSERT(be32_to_cpu(block->bb_magic) == XFS_ABTB_MAGIC ||
+			       be32_to_cpu(block->bb_magic) == XFS_ABTB_CRC_MAGIC);
 		}
 
 		/*