Skip to contentSkip to conversation

mtd: sm_ftl: fix typo in major number.

PATCH Applied Maxim Levitsky 3 participants 5 messages Mar 17, 2012 – May 19, 2012 1 message not in the archive Memory technology devices (MTD)

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 mtd: sm_ftl: fix typo in major number.

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

---
 drivers/mtd/sm_ftl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/sm_ftl.c +1 -1
index 072ed59..9e2dfd5 100644
@@ -1256,7 +1256,7 @@ static void sm_remove_dev(struct mtd_blktrans_dev *dev)
 
 static struct mtd_blktrans_ops sm_ftl_ops = {
 	.name		= "smblk",
-	.major		= -1,
+	.major		= 0,
 	.part_bits	= SM_FTL_PARTN_BITS,
 	.blksize	= SM_SECTOR_SIZE,
 	.getgeo		= sm_getgeo,
Signature · 1 line
1.7.9.1
#3 lore raw

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

In reply to Maxim Levitsky
Quoted 3 lines · Maxim Levitsky

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

Pushed to l2-mtd.git, thanks!

Signature · 2 lines
Best Regards,
Artem Bityutskiy

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

#4 lore raw
In reply to Maxim Levitsky
Quoted 1 line · Maxim Levitsky

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
452380efbd72d8d41f53ea64c8a6ea1fedc4394d

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;
            continue;
        }

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.

#5 lore raw
Quoted 10 lines · Alex Elsayed
Quoted 1 line · Maxim Levitsky

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
452380efbd72d8d41f53ea64c8a6ea1fedc4394d

It is in Linuses tree already, so I cannot add the "Cc:
[email protected]" tag anymore. You should send a request to Greg and explain that you want this patch in -stable.

Signature · 2 lines
Best Regards,
Artem Bityutskiy