Thread (2 messages) 2 messages, 2 authors, 2017-10-10

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

From: Michael Lyle <hidden>
Date: 2017-10-10 04:14:37
Also in: linux-bcache

Tang,

Thanks for the patch.

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

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 <redacted>
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help