Skip to contentSkip to conversation

bcache: fix calling ida_simple_remove() withincorrect minor

PATCH Coly Li 1 participant 1 message May 8, 2017 1 message not in the archive bcache (block layer cache)

lore
Share & tools
lore

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

Coly Li

author
#1 lore raw
Quoted 34 lines · On 2017/5/8 下午12:48, [email protected] wrote:

Hello Coly,

> Hi Junhui,

>

> I think this is a design on purpose. Current multiple partitions bcache

> design is per-device, not per major number, and each bcache devices as

> 16 partitions at max.

>

> This is why when you see a bcache device is initialized, the first minor

> of the device will *BCACHE_MINORS.

>

> Your patch won't make all minor numbers of the partitions of a bcache

> device being continuous, IMHO this is not correct.

>

> Thanks.

>

> Coly

Quoted 6 lines

We get minor number by ida_simple_get(), but the minor what we are going to

relase is minor*BCACHE_MINORS, so we release a wrong minor minor*BCACHE_MINORS,

and the right minor number leakage occures.

I mean if there are partitions on bcache devices, like /dev/bcache0p1, /dev/bcache0p2 ... /dev/bcache0p16 /dev/bcache1p1, /dev/bcache1p2 ... /dev/bcache0p16

bcache0 is not the last level to allocate minor number, bcache0p1 is. What we should fix might be:
/dev/bcache0 has minor 0
/dev/bcache1 has minor 16
/dev/bcache2 has minor 32

Maybe I didn't understand you correctly. Can your patch make sure all partitions of a bcache device have adjacent minor numbers ? Correct me if I am wrong.

Signature · 1 line
Coly Li