Public bug reported: 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. ** Affects: mdadm (Ubuntu) Importance: Undecided Status: New ** Tags: patch-accepted-upstream -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1868708 Title: mdmon: device descriptor is not closed To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/mdadm/+bug/1868708/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs