[linux-lvm] lvm fails when /proc/devices contains "-1 smblk"

Zdenek Kabelac zkabelac at redhat.com
Sat Mar 17 20:51:40 UTC 2012


Dne 17.3.2012 18:31, Maxim Levitsky napsal(a):
> On Sat, 2012-03-17 at 16:12 +0000, Alasdair G Kergon wrote: 
>>> Dne 16.3.2012 07:28, John Mesmon napsal(a):
>>>> Block devices:
>>>>  -1 smblk
>>
>> That's outside the range of valid major numbers and surely shouldn't be getting
>> exposed to userspace in /proc/devices.
>>
>> static struct mtd_blktrans_ops sm_ftl_ops = {
>>         .name           = "smblk",
>>         .major          = -1,
>>
>> Why's -1 being used?
>>
>> Alasdair
> 
> Woops. I accidentally assigned it 4096 major.
> I probably thought that it will get me dynamic major number, sorry!
> Will fix soon!
> 


So I've made couple experiments, and it seem that numbers printed via
/proc/devices  are actually not reflecting kernel reality.


It seems that if the kernel driver uses i.e. 'major == -4290'
then  cat /proc/devices  shows exactly this number (-4290).

But the device physically appears with major 3902.
So obviously kernel masks 0xfff and it's using it as unsigned number.

I'll update lvm code to go with same logic - while probably giving a user
warning, the major number used for device is not correct (so they could fixed
just like in smblk case).

Also I guess kernel patch which would fix this behavior might be useful as
well, but lvm needs to work with old kernels anyway.

Zdenek




More information about the linux-lvm mailing list