On 2017/5/8 下午2:44, tang.junhui@xxxxxxxxxx wrote: > Hello Coly, > > > > 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 > > > My patch does not break this. Please review the patch again. I think I come to understand you, yes your fix makes sense. In your patch d->disk->first_minor is assigned by IDA_TO_BCACHE_MINORS(minor), which left-shifts minor by 4 bits. So your patch will introduce a potential overflow for device minor number. MINORMASK is 20 bits, if you call ida_simple_get() like this, minor = ida_simple_get(&bcache_minor, 0, BCACHE_TO_IDA_MONIRS(MINORMASK + 1), GFP_KERNEL); The overflow should be removed. I have no more concern about your patch. Nice catch, thank you ! -- Coly Li -- To unsubscribe from this list: send the line "unsubscribe linux-bcache" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html