Tang,

Thanks for the patch.

On 10/09/2017 08:07 PM, [email protected] wrote:
From: Tang Junhui <[email protected]>

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 <[email protected]>

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

Reply via email to