[Bug 551827] New: /sbin/multipath -F cannot remove multipath volumes containing extended partitions
http://bugzilla.novell.com/show_bug.cgi?id=551827 Summary: /sbin/multipath -F cannot remove multipath volumes containing extended partitions Classification: openSUSE Product: openSUSE 11.2 Version: RC 2 Platform: All OS/Version: openSUSE 11.2 Status: NEW Severity: Major Priority: P5 - None Component: Basesystem AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: nice@titanic.nyme.hu QAContact: qa@suse.de Found By: --- Created an attachment (id=325106) --> (http://bugzilla.novell.com/attachment.cgi?id=325106) A patch to fix /etc/init.d/boot.multipath User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; hu-HU; rv:1.9.1.3) Gecko/20090909 SUSE/3.5.3-3.2 Firefox/3.5.3 /sbin/multipath -F can even remove the primary partitions from multipath volumes, but partitions inside of extended partitions and thus the extended partitions themselves and thus the multipath volumes themselves won't be removed. It means that /etc/init.d/boot.multipath does not work. This might be caused by the order in which multipath tries to remove the devices (i.e. extended partitions before the inner partitions in them). Reproducible: Always Steps to Reproduce: 1. Deploy a system with multipath volumes containing extanded partitions and partitions inside extended ones. 2. Enable the boot.multipath and multipathd services 3. Restart the machine 4. Shut down the system or issue /etc/init.d/boot.multipath stop Actual Results: carrier5:/etc/init.d # /etc/init.d/boot.multipath stop Removing multipath targets:Nov 02 12:33:30 | mpathr: map in use Nov 02 12:33:30 | mpathe: map in use Nov 02 12:33:30 | mpathd: map in use Nov 02 12:33:30 | mpathc: map in use Nov 02 12:33:30 | mpatho: map in use Nov 02 12:33:30 | mpathb: map in use Nov 02 12:33:30 | mpathn: map in use Nov 02 12:33:30 | mpathz: map in use Nov 02 12:33:30 | mpathl: map in use Nov 02 12:33:30 | mpathx: map in use Nov 02 12:33:30 | mpathw: map in use Nov 02 12:33:30 | mpathac: map in use Nov 02 12:33:30 | mpathv: map in use Nov 02 12:33:30 | mpathab: map in use Nov 02 12:33:31 | mpathi: map in use Nov 02 12:33:31 | mpathu: map in use Nov 02 12:33:31 | mpathh: map in use Nov 02 12:33:31 | mpathg: map in use Nov 02 12:33:31 | mpaths: map in use Nov 02 12:33:31 | mpathf: map in use Expected Results: All the multipath volumes shold be ramoved properly. This patch is a "forward-port" from older openSUSE releases, and seems to work perfectly on openSUSE 11.2 for me. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=551827 Tamás Németh <nice@titanic.nyme.hu> changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|bnc-team-screening@forge.pr |hare@novell.com |ovo.novell.com | -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=551827 User nice@titanic.nyme.hu added comment http://bugzilla.novell.com/show_bug.cgi?id=551827#c1 --- Comment #1 from Tamás Németh <nice@titanic.nyme.hu> 2009-11-02 04:40:27 MST --- *** Bug 468826 has been marked as a duplicate of this bug. *** http://bugzilla.novell.com/show_bug.cgi?id=468826 -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=551827 User hare@novell.com added comment http://bugzilla.novell.com/show_bug.cgi?id=551827#c2 Hannes Reinecke <hare@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED --- Comment #2 from Hannes Reinecke <hare@novell.com> 2009-11-12 07:45:11 MST --- I would rather prefer to have it fixed within multipath-tools themselves, as 'multipath -F' should work here, too. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=551827 http://bugzilla.novell.com/show_bug.cgi?id=551827#c3 Hannes Reinecke <hare@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hare@novell.com AssignedTo|hare@novell.com |cmeng@novell.com --- Comment #3 from Hannes Reinecke <hare@novell.com> 2010-01-20 15:54:03 UTC --- cong, would you mind having a look here? The problem here is that kpartx will generate nested partition tables now, ie a linear table (for the partition) will be mapped onto another linear table (for the extended partition), which in turn is mapped onto the multipath table. The current code only expects one linear table, not a stacked one. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=551827 http://bugzilla.novell.com/show_bug.cgi?id=551827#c4 --- Comment #4 from cong meng <cmeng@novell.com> 2010-01-21 11:25:18 UTC --- Hannes, ok. I will have a look at this bug. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=551827 http://bugzilla.novell.com/show_bug.cgi?id=551827#c5 cong meng <cmeng@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED --- Comment #5 from cong meng <cmeng@novell.com> 2010-01-25 06:47:31 UTC --- Fixed. The patch below has been summited to Base:System in OBS. Close it. Index: multipath-tools-0.4.8/libmultipath/devmapper.c =================================================================== --- multipath-tools-0.4.8.orig/libmultipath/devmapper.c +++ multipath-tools-0.4.8/libmultipath/devmapper.c @@ -951,14 +951,12 @@ dm_remove_partmaps (const char * mapname /* * and the multipath mapname and the part mapname start - * the same + * the same. + * -2: It's assumed that the last 2 characters are + * different between the logical partition name and the + * extended partition name at most. */ - !strncmp(names->name, mapname, strlen(mapname)) && - - /* - * and the opencount is 0 for us to allow removal - */ - !dm_get_opencount(names->name) && + !strncmp(names->name, mapname, strlen(mapname) - 2) && /* * and we can fetch the map table from the kernel @@ -974,6 +972,19 @@ dm_remove_partmaps (const char * mapname * then it's a kpartx generated partition. * remove it. */ + + /* + * if the opencount is not 0, maybe some other + * partitons depend on it. + */ + if (dm_get_opencount(names->name)) { + dm_remove_partmaps(names->name); + if (dm_get_opencount(names->name)) { + condlog(2, "%s: map in use", names->name); + goto out; + } + } + condlog(4, "partition map %s removed", names->name); dm_simplecmd_flush(DM_DEVICE_REMOVE, names->name); -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=551827 http://bugzilla.novell.com/show_bug.cgi?id=551827#c6 Hannes Reinecke <hare@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED | --- Comment #6 from Hannes Reinecke <hare@novell.com> 2010-01-25 07:36:12 UTC --- NACK. + * -2: It's assumed that the last 2 characters are + * different between the logical partition name and the + * extended partition name at most. Why two characters? I don't think there is an actual limit on the number of logical partitions, seeing that they are just linked lists. The correct check here would be to compare the base device name, as all partitions have a naming scheme like: <base device>-part<partno> so we should be just comparing the start of the string up to the '-part<partno>' suffix. But note that even <base device> might contain a '-', so one should exercise some care here. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=551827 http://bugzilla.novell.com/show_bug.cgi?id=551827#c7 --- Comment #7 from Hannes Reinecke <hare@novell.com> 2010-01-25 09:34:44 UTC --- *** Bug 468826 has been marked as a duplicate of this bug. *** http://bugzilla.novell.com/show_bug.cgi?id=468826 -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=551827 http://bugzilla.novell.com/show_bug.cgi?id=551827#c8 --- Comment #8 from cong meng <cmeng@novell.com> 2010-01-25 10:31:59 UTC --- Ok. I will refix it assuming that "_part" delimiter of kpartx won't be changed specified in udev rule file: "70-kpartx.rules". -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=551827 http://bugzilla.novell.com/show_bug.cgi?id=551827#c9 --- Comment #9 from Hannes Reinecke <hare@novell.com> 2010-01-25 13:34:48 UTC --- Better still would be to fix it using the device-mapper UUID. The uuid is set by kpartx internally with no means for the user to change it. The name of the device can be anything and there is no guarantee about a specific nameing scheme. The UUID OTOH is generated by the program and as such far more reliable. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=551827 http://bugzilla.novell.com/show_bug.cgi?id=551827#c10 --- Comment #10 from cong meng <cmeng@novell.com> 2010-01-27 08:21:11 UTC --- Hannes, please help me to review this patch, thanks. Index: multipath-tools-0.4.8/libmultipath/devmapper.c =================================================================== --- multipath-tools-0.4.8.orig/libmultipath/devmapper.c +++ multipath-tools-0.4.8/libmultipath/devmapper.c @@ -912,6 +912,60 @@ bad: return NULL; } +dm_get_full_uuid(char *name, char *uuid) +{ + struct dm_task *dmt; + const char *uuidtmp; + int r = 1; + + dmt = dm_task_create(DM_DEVICE_INFO); + if (!dmt) + return 1; + + if (!dm_task_set_name (dmt, name)) + goto uuidout; + + if (!dm_task_run(dmt)) + goto uuidout; + + uuidtmp = dm_task_get_uuid(dmt); + if (uuidtmp) { + strcpy(uuid, uuidtmp); + } + else + uuid[0] = '\0'; + + r = 0; +uuidout: + dm_task_destroy(dmt); + return r; +} + +/* + * returns: + * 0 : if both uuids end with same suffix which starts with UUID_PREFIX + * 1 : otherwise + */ +int +dm_compare_uuid(const char* mapname1, const char* mapname2) +{ + char *p1, *p2; + char uuid1[WWID_SIZE], uuid2[WWID_SIZE]; + + if (dm_get_full_uuid(mapname1, uuid1)) + return 1; + + if (dm_get_full_uuid(mapname2, uuid2)) + return 1; + + p1 = strstr(uuid1, UUID_PREFIX); + p2 = strstr(uuid2, UUID_PREFIX); + if (p1 && p2 && !strcmp(p1, p2)) + return 0; + + return 1; +} + int dm_remove_partmaps (const char * mapname) { @@ -950,15 +1004,10 @@ dm_remove_partmaps (const char * mapname (dm_type(names->name, TGT_PART) > 0) && /* - * and the multipath mapname and the part mapname start - * the same + * and the both uuid end with same suffix which + * starts with UUID_PREFIX */ - !strncmp(names->name, mapname, strlen(mapname)) && - - /* - * and the opencount is 0 for us to allow removal - */ - !dm_get_opencount(names->name) && + !dm_compare_uuid(names->name, mapname) && /* * and we can fetch the map table from the kernel @@ -974,6 +1023,19 @@ dm_remove_partmaps (const char * mapname * then it's a kpartx generated partition. * remove it. */ + + /* + * if the opencount is not 0, maybe some other + * partitons depend on it. + */ + if (dm_get_opencount(names->name)) { + dm_remove_partmaps(names->name); + if (dm_get_opencount(names->name)) { + condlog(2, "%s: map in use", names->name); + goto out; + } + } + condlog(4, "partition map %s removed", names->name); dm_simplecmd_flush(DM_DEVICE_REMOVE, names->name); -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=551827 http://bugzilla.novell.com/show_bug.cgi?id=551827#c cong meng <cmeng@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |NEEDINFO Info Provider| |hare@novell.com -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=551827 http://bugzilla.novell.com/show_bug.cgi?id=551827#c11 --- Comment #11 from Hannes Reinecke <hare@novell.com> 2010-01-27 09:09:48 UTC --- Yes, that's nice. However, I think it might be better to use the existing 'dm_get_uuid' function here instead of introducing a new one for basically the same purpose. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=551827 http://bugzilla.novell.com/show_bug.cgi?id=551827#c12 --- Comment #12 from Hannes Reinecke <hare@novell.com> 2010-01-27 09:13:34 UTC --- Created an attachment (id=339054) --> (http://bugzilla.novell.com/attachment.cgi?id=339054) multipath-tools-flush-stacked-partitions Update 'multipath -f' to handle stacked partitions. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=551827 http://bugzilla.novell.com/show_bug.cgi?id=551827#c13 --- Comment #13 from Hannes Reinecke <hare@novell.com> 2010-01-27 09:14:39 UTC --- I think that's better. I'll be testing with it. Thanks for the work. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=551827 http://bugzilla.novell.com/show_bug.cgi?id=551827#c14 Hannes Reinecke <hare@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |REOPENED Info Provider|hare@novell.com | AssignedTo|cmeng@novell.com |hare@novell.com --- Comment #14 from Hannes Reinecke <hare@novell.com> 2010-01-28 14:41:05 UTC --- Patch has been added to my multipath repository for SLES11 and SLES11 SP1. Anja, for the next update. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=551827 http://bugzilla.novell.com/show_bug.cgi?id=551827#c Hannes Reinecke <hare@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |NEEDINFO Info Provider| |ast@novell.com -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=551827 http://bugzilla.novell.com/show_bug.cgi?id=551827#c Swamp Workflow Management <swamp@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status Whiteboard| |maint:planned:update -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=551827 http://bugzilla.novell.com/show_bug.cgi?id=551827#c16 Swamp Workflow Management <swamp@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status Whiteboard|maint:planned:update |maint:running:30880 --- Comment #16 from Swamp Workflow Management <swamp@suse.com> 2010-02-08 11:02:38 UTC --- The SWAMPID for this issue is 30880. Please submit the patch and patchinfo file using this ID. (https://swamp.suse.de/webswamp/wf/30880) -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=551827 http://bugzilla.novell.com/show_bug.cgi?id=551827#c17 Swamp Workflow Management <swamp@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status Whiteboard|maint:running:30880 |maint:running:30880 | |maint:released:sle11:31833 --- Comment #17 from Swamp Workflow Management <swamp@suse.com> 2010-03-24 11:01:43 UTC --- Update released for: kpartx, multipath-tools, multipath-tools-debuginfo, multipath-tools-debugsource Products: SLE-DEBUGINFO 11 (i386, ia64, ppc64, s390x, x86_64) SLE-DESKTOP 11 (i386, x86_64) SLE-SERVER 11 (i386, ia64, ppc64, s390x, x86_64) -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=551827 http://bugzilla.novell.com/show_bug.cgi?id=551827#c Swamp Workflow Management <swamp@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status Whiteboard|maint:running:30880 |maint:released:sle11:31833 |maint:released:sle11:31833 | -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=551827 http://bugzilla.novell.com/show_bug.cgi?id=551827#c18 Hannes Reinecke <hare@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED --- Comment #18 from Hannes Reinecke <hare@novell.com> 2010-06-04 10:48:07 UTC --- Update has been released. Closing. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com