All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs_copy: accept XFS_ABTB_CRC_MAGIC
@ 2014-02-26  2:03 Eric Sandeen
  2014-02-26  2:07 ` Christoph Hellwig
  2014-02-26 16:22 ` [PATCH V2] xfs_copy: band-aids for CRC filesystems Eric Sandeen
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Sandeen @ 2014-02-26  2:03 UTC (permalink / raw)
  To: xfs-oss

xfs_copy needs a fair bit of work for CRCs because it rewrites
UUIDs by default, but this change will get it working properly
with the "-d" (duplicate) option which keeps the same UUID.

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

However, I wonder if we should fail CRC filesystems outright
for now if -d isn't specified, because it will invalidate every
CRC and generally make a mess of things...

diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index 9986fbf..7c807a4 100644
--- a/copy/xfs_copy.c
+++ b/copy/xfs_copy.c
@@ -957,7 +957,9 @@ 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_sb_version_hascrc(&mp->m_sb) ?
+				 XFS_ABTB_CRC_MAGIC : XFS_ABTB_MAGIC));
 
 			if (be16_to_cpu(block->bb_level) == 0)
 				break;

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfs_copy: accept XFS_ABTB_CRC_MAGIC
  2014-02-26  2:03 [PATCH] xfs_copy: accept XFS_ABTB_CRC_MAGIC Eric Sandeen
@ 2014-02-26  2:07 ` Christoph Hellwig
  2014-02-26  6:02   ` Dave Chinner
  2014-02-26 16:22 ` [PATCH V2] xfs_copy: band-aids for CRC filesystems Eric Sandeen
  1 sibling, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2014-02-26  2:07 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs-oss

On Tue, Feb 25, 2014 at 08:03:20PM -0600, Eric Sandeen wrote:
> xfs_copy needs a fair bit of work for CRCs because it rewrites
> UUIDs by default, but this change will get it working properly
> with the "-d" (duplicate) option which keeps the same UUID.

I don't think ASSERTs for user supplied data are a good idea, this
should be some real error handling.

> However, I wonder if we should fail CRC filesystems outright
> for now if -d isn't specified, because it will invalidate every
> CRC and generally make a mess of things...

Yeah, for now it probably should be rejected.

It would also be useful to have a list of such issues in an README.v5
or TODO.v5 file in the xfsprogs tree.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfs_copy: accept XFS_ABTB_CRC_MAGIC
  2014-02-26  2:07 ` Christoph Hellwig
@ 2014-02-26  6:02   ` Dave Chinner
  0 siblings, 0 replies; 5+ messages in thread
From: Dave Chinner @ 2014-02-26  6:02 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Eric Sandeen, xfs-oss

On Tue, Feb 25, 2014 at 06:07:37PM -0800, Christoph Hellwig wrote:
> On Tue, Feb 25, 2014 at 08:03:20PM -0600, Eric Sandeen wrote:
> > xfs_copy needs a fair bit of work for CRCs because it rewrites
> > UUIDs by default, but this change will get it working properly
> > with the "-d" (duplicate) option which keeps the same UUID.
> 
> I don't think ASSERTs for user supplied data are a good idea, this
> should be some real error handling.
> 
> > However, I wonder if we should fail CRC filesystems outright
> > for now if -d isn't specified, because it will invalidate every
> > CRC and generally make a mess of things...
> 
> Yeah, for now it probably should be rejected.
> 
> It would also be useful to have a list of such issues in an README.v5
> or TODO.v5 file in the xfsprogs tree.

Well, I thought we had just about got everything except for the
remaining repair cleanups and the logprint failure in xfs/295 up
until Eric mentioned UUIDs and xfs_copy/xfs_admin yesterday on IIRC.
I can't think of anything else that is needs to be finished for a
userspace release - I think that covers all the remaining xfstests
failures I'm seeing on crc enabled filesystems....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH V2] xfs_copy: band-aids for CRC filesystems
  2014-02-26  2:03 [PATCH] xfs_copy: accept XFS_ABTB_CRC_MAGIC Eric Sandeen
  2014-02-26  2:07 ` Christoph Hellwig
@ 2014-02-26 16:22 ` Eric Sandeen
  2014-02-26 20:48   ` Christoph Hellwig
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Sandeen @ 2014-02-26 16:22 UTC (permalink / raw)
  To: Eric Sandeen, xfs-oss, Christoph Hellwig

xfs_copy needs a fair bit of work for CRCs because it rewrites
UUIDs by default, but this change will get it working properly
with the "-d" (duplicate) option which keeps the same UUID.

Accept the the CRC magic valid, change the ASSERT() to an error
message and exit more gracefully, and don't
even get started if we don't have the '-d' option.

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

diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index 9986fbf..f443568 100644
--- a/copy/xfs_copy.c
+++ b/copy/xfs_copy.c
@@ -684,6 +684,16 @@ main(int argc, char **argv)
 	sb = &mbuf.m_sb;
 	libxfs_sb_from_disk(sb, XFS_BUF_TO_SBP(sbp));
 
+	/*
+	 * For now, V5 superblock filesystems are not supported without -d;
+	 * we do not have the infrastructure yet to fix CRCs when a new UUID
+	 * is generated.
+	 */
+	if (xfs_sb_version_hascrc(sb) && !duplicate) {
+		do_log(_("%s: Cannot yet copy V5 fs without '-d'\n"), progname);
+		exit(1);
+	}
+
 	mp = libxfs_mount(&mbuf, sb, xargs.ddev, xargs.logdev, xargs.rtdev, 0);
 	if (mp == NULL) {
 		do_log(_("%s: %s filesystem failed to initialize\n"
@@ -957,7 +967,13 @@ main(int argc, char **argv)
 				 ((char *)btree_buf.data +
 				  pos - btree_buf.position);
 
-			ASSERT(be32_to_cpu(block->bb_magic) == XFS_ABTB_MAGIC);
+			if (be32_to_cpu(block->bb_magic) !=
+			    (xfs_sb_version_hascrc(&mp->m_sb) ?
+			     XFS_ABTB_CRC_MAGIC : XFS_ABTB_MAGIC)) {
+				do_log(_("Bad btree magic 0x%x\n"),
+				        be32_to_cpu(block->bb_magic));
+				exit(1);
+			}
 
 			if (be16_to_cpu(block->bb_level) == 0)
 				break;


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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH V2] xfs_copy: band-aids for CRC filesystems
  2014-02-26 16:22 ` [PATCH V2] xfs_copy: band-aids for CRC filesystems Eric Sandeen
@ 2014-02-26 20:48   ` Christoph Hellwig
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2014-02-26 20:48 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Christoph Hellwig, Eric Sandeen, xfs-oss

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-02-26 20:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-26  2:03 [PATCH] xfs_copy: accept XFS_ABTB_CRC_MAGIC Eric Sandeen
2014-02-26  2:07 ` Christoph Hellwig
2014-02-26  6:02   ` Dave Chinner
2014-02-26 16:22 ` [PATCH V2] xfs_copy: band-aids for CRC filesystems Eric Sandeen
2014-02-26 20:48   ` Christoph Hellwig

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.