From: Darrick J. Wong Date: Wed, 30 Sep 2020 14:59:15 +0000 (-0400) Subject: mkfs: don't allow creation of realtime files from a proto file X-Git-Tag: xfsprogs-5.9-fixes2_2020-10-10~9 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=221ec450460da8e7a0b17e2561566ce2463ccb52;p=thirdparty%2Fxfsprogs-dev.git mkfs: don't allow creation of realtime files from a proto file If someone runs mkfs with rtinherit=1, a realtime volume configured, and a protofile that creates a regular file in the filesystem, mkfs will error out with "Function not implemented" because userspace doesn't know how to allocate extents from the rt bitmap. Catch this specific case and hand back a somewhat nicer explanation of what happened. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen Signed-off-by: Eric Sandeen --- diff --git a/mkfs/proto.c b/mkfs/proto.c index 9db8fe2d6..20a7cc3bb 100644 --- a/mkfs/proto.c +++ b/mkfs/proto.c @@ -244,6 +244,12 @@ newfile( nb = XFS_B_TO_FSB(mp, len); nmap = 1; error = -libxfs_bmapi_write(tp, ip, 0, nb, 0, nb, &map, &nmap); + if (error == ENOSYS && XFS_IS_REALTIME_INODE(ip)) { + fprintf(stderr, + _("%s: creating realtime files from proto file not supported.\n"), + progname); + exit(1); + } if (error) { fail(_("error allocating space for a file"), error); }