[VROC] mdadm detects dm-device as partition
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
linux (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
We discovered an issue when trying to create imsm container with mdadm on dm-device.
Environment:
OS: Ubuntu 24.04
Kernel: inbox 6.6.0
Scenario:
1. Create dm device
# echo -e '0 195312 linear /dev/nvme2n1 0' | dmsetup create nvme2n1DM
2. Create IMSM container.
# dmdev=$(readlink -f /dev/mapper/
# export IMSM_DEVNAME_
Expected result:
Container is created.
Actual result:
Error message is displayed
# mdadm: imsm: /dev/dm-0 is a partition, cannot be used in IMSM
Container is not created.
Additional info:
Mdadm uses ioctl call underneath to check if device is a partition. Here's the function:
int test_partition(int fd)
{
/* Check if fd is a whole-disk or a partition.
* BLKPG will return EINVAL on a partition, and BLKPG_DEL_PARTITION
* will return ENXIO on an invalid partition number.
*/
struct blkpg_ioctl_arg a;
struct blkpg_partition p;
a.op = BLKPG_DEL_
a.data = (void*)&p;
a.datalen = sizeof(p);
a.flags = 0;
memset(a.data, 0, a.datalen);
p.pno = 1<<30;
if (ioctl(fd, BLKPG, &a) == 0)
/* Very unlikely, but not a partition */
return 0;
if (errno == ENXIO || errno == ENOTTY)
/* not a partition */
return 0;
return 1;
}
We established that the behavior is caused by regression in ioctl.
Thread: https:/
Fix: https://<email address hidden>/
We established that ioctl call on dm-device returns EINVAL as if it was a partition.
Note that this function was was working unchanged for last 10+years and the issue was fixed in newer kenel.
Changed in linux (Ubuntu): | |
status: | New → Won't Fix |
Changed in linux (Ubuntu): | |
status: | Won't Fix → Fix Released |
Thank you for taking the time to report this bug and helping to make Ubuntu better. It seems that your bug report is not filed about a specific source package though, rather it is just filed against Ubuntu in general. It is important that bug reports be filed about source packages so that people interested in the package can find the bugs about it. You can find some hints about determining what package your bug might be about at https:/ /wiki.ubuntu. com/Bugs/ FindRightPackag e. You might also ask for help in the #ubuntu-bugs irc channel on Libera.chat.
To change the source package that this bug is filed about visit https:/ /bugs.launchpad .net/ubuntu/ +bug/2059092/ +editstatus and add the package name in the text box next to the word Package.
[This is an automated message. I apologize if it reached you inappropriately; please just reply to this message indicating so.]