Re: [PATCH] bcache: fix race in setting bdev state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tang,

Thanks for the patch.

On 10/09/2017 08:07 PM, tang.junhui@xxxxxxxxxx wrote:
From: Tang Junhui <tang.junhui@xxxxxxxxxx>

cached_dev_put() is called before setting and writing bdev to
BDEV_STATE_CLEAN state, but after calling cached_dev_put(),
detach work queue works, and bdev is also set to
BDEV_STATE_NONE state in cached_dev_detach_finish(),
it may cause race condition, and the state of bdev is uncertain.

Signed-off-by: Tang Junhui <tang.junhui@xxxxxxxxxx>

How did you find this? Did the race trigger at detach or was it through code inspection?

I need to analyze this more. It looks correct on its own, but there are a lot of atomic variables and the way they are used is complicated.

I'm inclined to think that detach should traverse the writeback lock for safety. It would be a lot less complicated to analyze what would happen. What do you think?

Thanks,

Mike



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux