[linux-lvm] [PATCH] mtd: sm_ftl: fix typo in major number.

Alex Elsayed eternaleye+usenet at gmail.com
Sat May 19 11:28:20 UTC 2012

Maxim Levitsky wrote:

> major == 0 allocates dynamic major, not major == -1

I would appreciate if this could be submitted for -stable, since the 
negative major number breaks LVM (regardless of whether any such devices are 
present). I found this out the hard way when my system failed to boot. 

-stable note: This is in Linus' tree as 

For those who don't know (and potentially as a preface for -stable) the 
reason lies in LVM's filtering; in lib/filter/filter.c, lines 230-233:

        if ((line_maj <= 0) || (line_maj >= NUMBER_OF_MAJORS)) {
            blocksection = (line[i] == 'B') ? 1 : 0;

Basically, it scans through /proc/devices until it hits a line starting with 
'B', at which point it starts processing block major numbers and 
whitelisting them to be used as PVs. However, the negative number causes a 
problem because it a.) sorts to the top of the list and b.) short-circuits 
the if(). This causes blocksection to flip back to zero immediately, 
terminating the enumeration of permitted devices before any actually get 
whitelisted. As a result, *all* block devices are ignored, with messages 
such as

Skipping: Unrecognised LVM device type 259

259 being blkext, which LVM explicitly allows.

More information about the linux-lvm mailing list