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 2031936

Summary: mdadm --monitor --scan immediately exit when RAID level is 0
Product: Red Hat Enterprise Linux 8 Reporter: Takuya ASADA <syuu>
Component: mdadmAssignee: Nigel Croxon <ncroxon>
Status: CLOSED NOTABUG QA Contact: Storage QE <storage-qe>
Severity: unspecified Docs Contact:
Priority: high    
Version: 8.5CC: avi.kivity, dledford, jdonohue, ncroxon
Target Milestone: rcKeywords: Triaged
Target Release: 8.7Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-01-13 14:11:16 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 Takuya ASADA 2021-12-13 18:22:11 UTC
Description of problem:
I noticed that mdmonitor.service fails on latest EL8, tried to run command directly on shell, then I found that mdadm --monitor --scan immediately exit without any error message.
I also found that it only occur on RAID0.

I look into mdadm code, I guess check_array() has a bug:
https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/Monitor.c?h=mdadm-4.1#n519
	if (sra->array.level == 0 || sra->array.level == -1) {
		if (!st->err && !st->from_config)
			alert("DeviceDisappeared", dev, " Wrong-Level", ainfo);
		st->err++;
		goto out;
	}

It sets st->err++ unconditionally RAID level is 0.
Since st->err is non-zero, Monitor() will break while-loop at:
https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/Monitor.c#n260
			else if (!anyredundant) {
				pr_err("No array with redundancy detected, stopping\n");
				break;
			}


(The pr_err message only on latest tree of mdadm, not on EL8 package version)

Version-Release number of selected component (if applicable):
mdadm-4.1-15 and later

How reproducible:
See the step

Steps to Reproduce:
1. sudo mdadm --create --run /dev/md0 --level=0 --raid-devices=2 /dev/nvme1n1 /dev/nvme2n1
2. sudo mdadm --detail --scan |sudo tee /etc/mdadm.conf
3. echo MAILADDR=root |sudo tee -a /etc/mdadm.conf 
4. sudo mdadm --monitor --scan

Actual results:
mdadm --monitor immediately exit

Expected results:
mdadm --monitor keep running

Additional info:

Comment 1 Nigel Croxon 2022-01-13 14:11:16 UTC
mdadm --monitor only watches raid levels with redundancy.

mdadm: No array with redundancy detected, stopping