[PATCH] mkfs: test that -l su is a multiple of block size

Jan Tulak jtulak at redhat.com
Thu Jun 9 08:41:40 CDT 2016


lsunit was already tested, but lsu was not. So a thing like -l su=4097 was
possible. This commit adds a check to fix it.

Signed-off-by: Jan Tulak <jtulak at redhat.com>
---
 mkfs/xfs_mkfs.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 455bf11..b9b50fe 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -2875,6 +2875,15 @@ an AG size that is one stripe unit smaller, for example %llu.\n"),
 		lsunit = dsunit;
 	}
 
+	if (lsu) {
+		if (lsu % blocksize != 0) {
+			fprintf(stderr,
+	_("log stripe unit (%d) must be a multiple of the block size (%d)\n"),
+			lsu, blocksize);
+			exit(1);
+		}
+	}
+
 	if (sb_feat.log_version == 2 && (lsunit * blocksize) > 256 * 1024) {
 		/* Warn only if specified on commandline */
 		if (lsuflag || lsunitflag) {
-- 
2.5.5



More information about the xfs mailing list