On 9/30/20 9:58 AM, Darrick J. Wong wrote: > From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > > 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 <darrick.wong@xxxxxxxxxx> seems fine in general but a couple thoughts... > --- > libxfs/init.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/libxfs/init.c b/libxfs/init.c > index cb8967bc77d4..1a966084ffea 100644 > --- a/libxfs/init.c > +++ b/libxfs/init.c > @@ -724,6 +724,20 @@ libxfs_mount( > exit(1); > } > > + if (xfs_sb_version_hasreflink(sbp) && sbp->sb_rblocks) { Hm, we really don't use xfs_sb_version_hasrealtime() very consistently, but it might be worth doing here? I wish we had a feature flag to cross-ref against, a corruption in sb_rblocks will lead to an untouchable filesystem, but I guess there's nothing we can do about that. Actually, would it help to cross-check against the rtdev arg as well? Should we do anything different if the user actually specified a realtime device on the commandline? I mean, I suppose > + fprintf(stderr, > + _("%s: Reflink not compatible with realtime device. Please try a newer xfsprogs.\n"), I like this optimism. ;) > + progname); > + exit(1); > + } > + > + if (xfs_sb_version_hasrmapbt(sbp) && sbp->sb_rblocks) { > + fprintf(stderr, > + _("%s: Reverse mapping btree not compatible with realtime device. Please try a newer xfsprogs.\n"), > + progname); > + exit(1); > + } > + > xfs_da_mount(mp); > > if (xfs_sb_version_hasattr2(&mp->m_sb)) >