Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1885665

Summary: do no support write_behind disks with clustered bitmaps
Product: Red Hat Enterprise Linux 8 Reporter: Nigel Croxon <ncroxon>
Component: mdadmAssignee: XiaoNi <xni>
Status: CLOSED ERRATA QA Contact: Fine Fan <ffan>
Severity: high Docs Contact:
Priority: high    
Version: 8.3CC: cwei, dledford, heinzm, jbrassow, ncroxon, xni
Target Milestone: rcKeywords: Triaged
Target Release: 8.6Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: mdadm-4.2-rc3.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-10 15:29:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Nigel Croxon 2020-10-06 16:09:44 UTC
Description of problem:

Do not support creating or growing a MD array with a clustered bitmap and disks with writemostly set.

Version-Release number of selected component (if applicable):


How reproducible:

Create an MD array on a clustered system (--bitmap=clustered) and disks with the write mostly (--write-mostly) flag set.

Or grow an MD array on a non-clustered bitmap to a clustered bitmap with disks having the write mostly flag set.

Steps to Reproduce:
1. mdadm -CR /dev/md0 -l1 --raid-devices=2 /dev/sda --write-mostly /dev/sdb --bitmap=clustered

or 
1. mdadm -CR /dev/md0 -l1 --raid-devices=2 /dev/sda --write-mostly /dev/sdb
2. mdadm --grow /dev/md0 --bitmap=clustered


Actual results:

The creation of the MD array is successful.

Expected results:

The creation or growing of the MD array should fail with an error message stating: 
Can not set --write-mostly with a clustered bitmap.
and disks marked write-mostly are not supported with clustered bitmap.


Additional info:

Comment 1 Jonathan Earl Brassow 2020-10-07 04:41:47 UTC
/might/ be allowable if all machines have the same view and it is not allowed to change in an uncoordinated way.  Need to discuss.  (Perhaps disallowing is the best coarse of action until it can be assessed.)

Comment 2 Nigel Croxon 2020-10-28 14:21:40 UTC
Reason:

Signed-off-by: Nigel Croxon <ncroxon>
---
Create.c | 9 +++++++--
Grow.c   | 5 +++++
2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/Create.c b/Create.c
index 6f84e5b..de9cdc4 100644
--- a/Create.c
+++ b/Create.c
@@ -898,8 +898,13 @@ int Create(struct supertype *st, char *mddev,
				else
					inf->disk.state = 0;

-				if (dv->writemostly == FlagSet)
-					inf->disk.state |= (1<<MD_DISK_WRITEMOSTLY);
+				if (dv->writemostly == FlagSet) {
+					if (major_num == BITMAP_MAJOR_CLUSTERED) {
+						pr_err("Can not set --write-mostly with a clustered bitmap\n");
+						goto abort_locked;
+					} else 
+						inf->disk.state |= (1<<MD_DISK_WRITEMOSTLY);
+				}
				if (dv->failfast == FlagSet)
					inf->disk.state |= (1<<MD_DISK_FAILFAST);

diff --git a/Grow.c b/Grow.c
index 57db7d4..eea9ff1 100644
--- a/Grow.c
+++ b/Grow.c
@@ -421,6 +421,11 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
			dv = map_dev(disk.major, disk.minor, 1);
			if (!dv)
				continue;
+			if (((disk.state & (1 << MD_DISK_WRITEMOSTLY)) == 0) &&
+			   (strcmp(s->bitmap_file, "clustered") == 0)) {
+				pr_err("disks marked write-mostly are not supported with clustered bitmap\n");
+				return 1;
+			}
			fd2 = dev_open(dv, O_RDWR);
			if (fd2 < 0)
				continue;
-- 
2.18.4

Comment 5 Fine Fan 2021-07-15 01:55:07 UTC
Move it to ITM 22

Comment 6 Fine Fan 2021-07-31 16:09:33 UTC
Move ITM to 24

Comment 7 Fine Fan 2021-08-15 09:12:48 UTC
Move ITM to 26

Comment 9 Nigel Croxon 2021-08-31 20:03:07 UTC
https://www.spinics.net/lists/raid/msg68230.html

Comment 11 Nigel Croxon 2021-10-11 12:47:50 UTC
On 8/23/21 8:48 AM, Nigel Croxon wrote:
> Do not support creating an MD array on a clustered system
> (--bitmap=clustered) and disks with the write mostly
> (--write-mostly) flag set.
>
> Or do not grow an MD array on a non-clustered bitmap to a
> clustered bitmap with disks having the write mostly flag set.
>
> The actual results is the MD array is created successfully.
> But the expected results should be a failure with an
> error message stating:
> Can not set --write-mostly with a clustered bitmap.
> and disks marked write-mostly are not supported with clustered bitmap.
>
> V2:
> Added the device name in the error message during creation:
> mdadm -CR /dev/md0 -l1 --raid-devices=2 /dev/sda --write-mostly /dev/sdb --bitmap=clustered
> mdadm: Can not set /dev/sdb --write-mostly with a clustered bitmap.
>
> Added the array name in the error message when growing:
> mdadm --grow /dev/md0 --bitmap=clustered
> mdadm: /dev/md0 disks marked write-mostly are not supported with clustered bitmap
>
> Signed-off-by: Nigel Croxon <ncroxon>
> ---
>  Create.c | 9 +++++++--
>  Grow.c   | 5 +++++
>  2 files changed, 12 insertions(+), 2 deletions(-)
>

Applied!

Thanks
Jes

Comment 21 errata-xmlrpc 2022-05-10 15:29:19 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (mdadm bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:2087