dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/0008-Prevent-create-IMSM-volume-with-size-smaller-than-1M.patch

59ea72
From 54865c30d5b94920318950e29a4f6c1ce075cae8 Mon Sep 17 00:00:00 2001
59ea72
From: Roman Sobanski <roman.sobanski@intel.com>
59ea72
Date: Wed, 25 Apr 2018 11:25:06 +0200
59ea72
Subject: [RHEL7.5 PATCH 08/26] Prevent create IMSM volume with size smaller
59ea72
 than 1M or chunk
59ea72
59ea72
Block creation of the imsm volume when given size is smaller than 1M and
59ea72
print appropriate message.
59ea72
59ea72
Commit b53bfba6119d3f6f56eb9e10e5a59da6901af159
59ea72
(imsm: use rounded size for metadata initialization) introduces issue with
59ea72
rounding volume sizes smaller than 1M to 0. There is an inconsistency when
59ea72
size smaller than 1M was given depends of what we give as target device:
59ea72
1) When block devices was given created volume has maximum available size.
59ea72
2) When container symlink was given created volume has size 0. Additionally
59ea72
it causes below call trace:
59ea72
59ea72
[69587.891556] WARNING: CPU: 28 PID: 22485 at ../drivers/md/md.c:7582 md_seq_show+0x764/0x770 [md_mod]
59ea72
[69588.066405] Call Trace:
59ea72
[69588.066409]  seq_read+0x336/0x430
59ea72
[69588.066411]  proc_reg_read+0x40/0x70
59ea72
[69588.066412]  __vfs_read+0x26/0x140
59ea72
[69588.066414]  vfs_read+0x89/0x130
59ea72
[69588.066415]  SyS_read+0x42/0x90
59ea72
[69588.066417]  do_syscall_64+0x74/0x140
59ea72
[69588.066419]  entry_SYSCALL_64_after_hwframe+0x3d/0xa2
59ea72
59ea72
Signed-off-by: Roman Sobanski <roman.sobanski@intel.com>
59ea72
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
59ea72
---
59ea72
 super-intel.c | 10 ++++++++++
59ea72
 1 file changed, 10 insertions(+)
59ea72
59ea72
diff --git a/super-intel.c b/super-intel.c
59ea72
index c55c85f..520abf5 100644
59ea72
--- a/super-intel.c
59ea72
+++ b/super-intel.c
59ea72
@@ -7358,6 +7358,16 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout,
59ea72
 							verbose);
59ea72
 	}
59ea72
 
59ea72
+	if (size && ((size < 1024) || (*chunk != UnSet &&
59ea72
+	    size < (unsigned long long) *chunk))) {
59ea72
+		pr_err("Given size must be greater than 1M and chunk size.\n");
59ea72
+		/* Depends on algorithm in Create.c :
59ea72
+		 * if container was given (dev == NULL) return -1,
59ea72
+		 * if block device was given ( dev != NULL) return 0.
59ea72
+		 */
59ea72
+		return dev ? -1 : 0;
59ea72
+	}
59ea72
+
59ea72
 	if (!dev) {
59ea72
 		if (st->sb) {
59ea72
 			struct intel_super *super = st->sb;
59ea72
-- 
59ea72
2.7.4
59ea72