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@xxxxxxxxxx> --- 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@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs