From: Darrick J. Wong Date: Wed, 30 Sep 2020 16:45:13 +0000 (-0400) Subject: libxfs: disallow filesystems with reverse mapping and reflink and realtime X-Git-Tag: xfsprogs-5.9-fixes2_2020-10-10~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4aaeedc4a1cc52f8bc49dfc9c89704aff92b7c5e;p=thirdparty%2Fxfsprogs-dev.git libxfs: disallow filesystems with reverse mapping and reflink and realtime Neither the kernel nor the code in xfsprogs support filesystems that have (either reverse mapping btrees or reflink) enabled and a realtime volume configured. The kernel rejects such combinations and mkfs refuses to format such a config, but xfsprogs doesn't check and can do Bad Things, so port those checks before someone shreds their filesystem. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen Signed-off-by: Eric Sandeen --- diff --git a/libxfs/init.c b/libxfs/init.c index cb8967bc7..330c64519 100644 --- a/libxfs/init.c +++ b/libxfs/init.c @@ -428,6 +428,21 @@ rtmount_init( sbp = &mp->m_sb; if (sbp->sb_rblocks == 0) return 0; + + if (xfs_sb_version_hasreflink(sbp)) { + fprintf(stderr, + _("%s: Reflink not compatible with realtime device. Please try a newer xfsprogs.\n"), + progname); + return -1; + } + + if (xfs_sb_version_hasrmapbt(sbp)) { + fprintf(stderr, + _("%s: Reverse mapping btree not compatible with realtime device. Please try a newer xfsprogs.\n"), + progname); + return -1; + } + if (mp->m_rtdev_targp->dev == 0 && !(flags & LIBXFS_MOUNT_DEBUGGER)) { fprintf(stderr, _("%s: filesystem has a realtime subvolume\n"), progname);