In December I reported a problem with seemingly being unable to activate more than nine LVs. There were no answers. Yesterday I tracked this down. It's real, but it's different. list_devices() in dm-ioctl.c forgets to take into account the terminating null for nl->name when calculating needed (although it does later in line 400 when actually filling the structs). Usually there would be one from the padding overhead, but ctl_ioctl() chops off the last byte when copying the ioctl argument back to user then. The effect is (after creating 10 LVs, lvtest0 to lvtest9, in vg00): # lvm vgchange -ay 9 logical volume(s) in volume group "vg00" now active # lvm lvs LV VG Attr LSize Origin Snap% Move Move% lvtest0 vg00 -wn--- 200.00M lvtest1 vg00 -wn-a- 200.00M lvtest2 vg00 -wn-a- 200.00M lvtest3 vg00 -wn-a- 200.00M lvtest4 vg00 -wn-a- 200.00M lvtest5 vg00 -wn-a- 200.00M lvtest6 vg00 -wn-a- 200.00M lvtest7 vg00 -wn-a- 200.00M lvtest8 vg00 -wn-a- 200.00M lvtest9 vg00 -wn-a- 200.00M # dmsetup ls vg00-lvtest9 (254, 9) vg00-lvtest8 (254, 8) vg00-lvtest7 (254, 7) vg00-lvtest6 (254, 6) vg00-lvtest5 (254, 5) vg00-lvtest4 (254, 4) vg00-lvtest3 (254, 3) vg00-lvtest2 (254, 2) vg00-lvtest (254, 1) As you can see the last character of the name of the last active LV is missing. This confuses lvm, which deactivates the LV it does not know anything about. Things work fine with my modification: # lvm vgchange -ay 10 logical volume(s) in volume group "vg00" now active # lvm lvs LV VG Attr LSize Origin Snap% Move Move% lvtest0 vg00 -wn-a- 200.00M lvtest1 vg00 -wn-a- 200.00M lvtest2 vg00 -wn-a- 200.00M lvtest3 vg00 -wn-a- 200.00M lvtest4 vg00 -wn-a- 200.00M lvtest5 vg00 -wn-a- 200.00M lvtest6 vg00 -wn-a- 200.00M lvtest7 vg00 -wn-a- 200.00M lvtest8 vg00 -wn-a- 200.00M lvtest9 vg00 -wn-a- 200.00M # dmsetup ls vg00-lvtest9 (254, 9) vg00-lvtest8 (254, 8) vg00-lvtest7 (254, 7) vg00-lvtest6 (254, 6) vg00-lvtest5 (254, 5) vg00-lvtest4 (254, 4) vg00-lvtest3 (254, 3) vg00-lvtest2 (254, 2) vg00-lvtest1 (254, 1) vg00-lvtest0 (254, 0) Patch attached. Not sure if there are other such cases in the code, but a quick look did not turn up anything. Comments? -Stefan -- junior guru SP666-RIPE JID:stefanp@jabber.de.cw.net SMP@IRC
--- drivers/md/dm-ioctl.c.orig 2004-04-18 10:57:26.829987376 +0200 +++ drivers/md/dm-ioctl.c 2004-04-18 20:51:10.418378768 +0200 @@ -366,7 +366,7 @@ for (i = 0; i < NUM_BUCKETS; i++) { list_for_each_entry (hc, _name_buckets + i, name_list) { needed += sizeof(struct dm_name_list); - needed += strlen(hc->name); + needed += strlen(hc->name) + 1; needed += ALIGN_MASK; } }
_______________________________________________ linux-lvm mailing list linux-lvm@redhat.com https://www.redhat.com/mailman/listinfo/linux-lvm read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/