File xfsprogs-mkfs.xfs-if-either-sunit-or-swidth-is-nonzero-the-ot.patch of Package xfsprogs.21555

From 14c57d50de912fae821f8c1e717144f3602566de Mon Sep 17 00:00:00 2001
From: Eric Sandeen <sandeen@redhat.com>
Date: Thu, 31 May 2018 14:09:55 -0500
Subject: [PATCH] mkfs.xfs: if either sunit or swidth is nonzero,  the other
 must be as well
Git-commit: 14c57d50de912fae821f8c1e717144f3602566de
Patch-mainline: v4.17.0-rc1
References: bsc#1085917 bsc#1181535

Don't allow the user to set one but not the other.

Reported-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Acked-by: Anthony Iliopoulos <ailiop@suse.com>

---
 mkfs/xfs_mkfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 2de017130831..a135e06e7215 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -2271,7 +2271,8 @@ _("data stripe width (%lld) is too large of a multiple of the data stripe unit (
 		dswidth = big_dswidth;
 	}
 
-	if (dsunit && (!dswidth || (dswidth % dsunit != 0))) {
+	if ((dsunit && !dswidth) || (!dsunit && dswidth) ||
+	    (dsunit && (dswidth % dsunit != 0))) {
 		fprintf(stderr,
 _("data stripe width (%d) must be a multiple of the data stripe unit (%d)\n"),
 			dswidth, dsunit);
-- 
2.30.0

openSUSE Build Service is sponsored by