mdmon: device descriptor is not closed

Bug #1868708 reported by Mariusz Tkaczyk
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OEM Priority Project
Fix Released
High
Unassigned
mdadm
Invalid
Undecided
Unassigned
mdadm (Ubuntu)
Fix Released
Undecided
Unassigned
Impish
Fix Released
Undecided
Unassigned

Bug Description

When device disappears from the system "mdadm -If" is triggered by udev and drive is removed from the corresponding array and container. The missing close() in metadata manager (mdmon) causes that userspace handler to the device is still opened (can be tracked by lsof -p <mdmon_pid>).

For nvme drives it causes weird namespace number after hot-plug (e.g. will appear nvme1n2). The issue affects only IMSM metadata format.
Reproducible on Focal with latest mdadm 4.1-5ubuntu1.

Steps:
1. Create IMSM container:
#mdadm -CR imsm -e imsm -n2 /dev/nvme[01]n1
2. Create IMSM array:
#mdadm -CR vol1 -l1 -n2 /dev/nvme[01]n1
3. remove via sysfs drive:
#echo 1 > /sys/block/nvme0n1/device/device/remove
4. restore the same drive:
#echo 1 > /sys/bus/pci/rescan
5. see mdstat and lsblk:
# cat /proc/mdstat

Result:
/dev/nvme0n2 appears in system.

Revision history for this message
Mariusz Tkaczyk (mtkaczyk) wrote :
Rex Tsai (chihchun)
tags: added: focal
Rex Tsai (chihchun)
Changed in oem-priority:
importance: Undecided → High
tags: added: vroc
Rex Tsai (chihchun)
tags: added: oem-priority
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in mdadm (Ubuntu):
status: New → Confirmed
Revision history for this message
Jeff Lane  (bladernr) wrote :

Can this please be targeted for 21.10 in subiquity?

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

I don't see how this has anything to do with subiquity?

Revision history for this message
Jeff Lane  (bladernr) wrote :

Sorry, that was an overzealous CopyPasta. I meant just for 20.10 for some of these (which are obviously not Subiquity parts).

Revision history for this message
Jeff Lane  (bladernr) wrote :

@chihchun, any update?

Revision history for this message
Jeff Lane  (bladernr) wrote :

Is this resolved in 4.2-rc2?

Changed in mdadm (Ubuntu):
status: Confirmed → Incomplete
Changed in mdadm:
status: New → Invalid
Revision history for this message
Mariusz Tkaczyk (mtkaczyk) wrote :

yes, it is resolved.

Jeff Lane  (bladernr)
Changed in mdadm (Ubuntu Impish):
status: Incomplete → Fix Committed
Jeff Lane  (bladernr)
Changed in mdadm (Ubuntu):
status: Fix Committed → Fix Released
Changed in mdadm (Ubuntu Impish):
status: Fix Committed → Fix Released
Changed in oem-priority:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.