public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: Eric Sandeen <sandeen@redhat.com>
Cc: xfs-oss <xfs@oss.sgi.com>
Subject: [PATCH 3/3] xfsdump: refuse restore of V4 format unless FS has projid32bit set
Date: Fri, 12 Oct 2012 16:42:27 -0500	[thread overview]
Message-ID: <50788EC3.2060701@sandeen.net> (raw)
In-Reply-To: <50788C50.40600@redhat.com>

Restoring a dump w/ the top 16 bits of a 32-bit project ID
set will fail to restore the full ID unless the projid32 feature
flag is set on the filesystem.

So if the target fs is xfs, fail the restore if we have a version
4 dump (only used currently if dumped from a projid32 fs) and
the target xfs filesystem does not have that feature set.

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

p.s. i'd rather go by whether the contents of the dump have any
> 16 bit project ids than by the feature flag, but I don't see
a way to do that.

diff --git a/restore/content.c b/restore/content.c
index edd00ed..fb15779 100644
--- a/restore/content.c
+++ b/restore/content.c
@@ -36,6 +36,7 @@
 #include <pthread.h>
 
 #include "types.h"
+#include "fs.h"
 #include "timeutil.h"
 #include "util.h"
 #include "cldmgr.h"
@@ -2021,6 +2022,8 @@ content_stream_restore( ix_t thrdix )
 		bool_t resumepr;
 		ix_t level;
 		uuid_t *baseidp;
+		uuid_t fsuuid;
+		__u32 fsflags = 0;
 
 		rv = Media_mfile_next( Mediap,
 				       PURP_SEARCH,
@@ -2160,6 +2163,29 @@ content_stream_restore( ix_t thrdix )
 			Media_end( Mediap );
 			return mlog_exit(EXIT_ERROR, RV_COMPAT);
 		}
+
+		/* if dump format supports 32 bit project IDs and target fs
+		 * is XFS, make sure the target fs supports it as well
+		 */
+		if ( persp->a.dstdirisxfspr &&
+		     grhdrp->gh_version >= GLOBAL_HDR_VERSION_4) {
+			rval = fs_getinfo(persp->a.dstdir, &fsuuid, &fsflags);
+			if ( rval ) {
+				mlog( MLOG_NORMAL | MLOG_WARNING, _(
+					"could not query filesystem features "
+					"for %s\n"),
+					persp->a.dstdir);
+			}
+			if (!(fsflags & XFS_FSOP_GEOM_FLAGS_PROJID32)) {
+				mlog( MLOG_NORMAL | MLOG_ERROR, _(
+					"dump version >= %d requires projid32 "
+					"feature on target filesystem\n"),
+					GLOBAL_HDR_VERSION_4);
+				Media_end( Mediap );
+				return mlog_exit(EXIT_ERROR, RV_COMPAT);
+			}
+		}
+
 		strncpyterm( persp->s.dumplab,
 			     grhdrp->gh_dumplabel,
 			     sizeof( persp->s.dumplab ));

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

  parent reply	other threads:[~2012-10-12 21:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-12 21:32 [PATCH 0/3] xfsdump: more projid32bit fixes Eric Sandeen
2012-10-12 21:35 ` [PATCH 1/3] xfsdump: extend fs_info to gather fs feature flags Eric Sandeen
2012-11-09 18:31   ` Rich Johnston
2012-10-12 21:37 ` [PATCH 2/3] xfsdump: default to V3, use V4 if projid32bit is set Eric Sandeen
2012-11-09 18:31   ` Rich Johnston
2012-11-09 18:32     ` Eric Sandeen
2012-10-12 21:42 ` Eric Sandeen [this message]
2012-11-09 18:32   ` [PATCH 3/3] xfsdump: refuse restore of V4 format unless FS has projid32bit set Rich Johnston
2012-10-22 14:36 ` [PATCH 0/3] xfsdump: more projid32bit fixes Eric Sandeen
2012-10-22 15:56   ` Ben Myers
2012-10-22 16:22     ` Eric Sandeen
2012-10-22 20:24       ` Ben Myers
2012-10-22 20:30         ` Eric Sandeen
2012-10-22 20:11 ` Eric Sandeen

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=50788EC3.2060701@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=sandeen@redhat.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