Skip to contentSkip to conversation

limit of 9 active LVs w/ LVM2?

linux-lvm In review Stefan Paletta 2 participants 3 messages Dec 22, 2003 – Apr 21, 2004

lore
Share & tools
lore
#0 lore raw

Dear LVM folks,

I'm using latest LVM2 / dm with various 2.6 kernels with devfs, and it seems to be impossible to have more than nine LVs active in a VG at any one time. Very weird behaviour. Activation of what would be the tenth results in another LV getting deactivated, although it remains open and usable if it was open before.
I can hardly imagine that this is intended behaviour, but I can also not find any previous reports of such a bug.

-Stefan

Signature · 1 line
 junior guru                               SP666-RIPE         SMP@IRC
#1 lore raw

PATCH 1/1 fix list_devices() (was: Re: [linux-lvm] limit of 9 active LVs w/ LVM2?)

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

Signature · 1 line
 junior guru   SP666-RIPE     JID:[email protected]    SMP@IRC
md/dm-ioctl.c renamed from md/dm-ioctl.c.orig +1 -1
@@ -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;
 		}
 	}
#2 lore raw

Re: [PATCH] fix list_devices() (was: Re: [linux-lvm] limit of 9 active LVs w/ LVM2?)

Stefan,

Thanks, this has been merged, and will be in the todays -udm release (subscribe to [email protected] for notification of these releases).

- Joe