Thread (3 messages) 3 messages, 3 authors, 2017-11-22

Re: [PATCH] bcache: stop writeback thread after detaching

From: Michael Lyle <hidden>
Date: 2017-11-22 05:18:37
Also in: linux-bcache

Tang Junhui--

Thanks for noticing this issue.

On Wed, Nov 1, 2017 at 4:55 AM, Coly Li [off-list ref] wrote:
On 2017/10/31 =E4=B8=8B=E5=8D=884:14, tang.junhui@zte.com.cn wrote:
quoted
From: Tang Junhui <redacted>

Currently, when a cached device detaching from cache, writeback thread i=
s not stopped,
quoted
and writeback_rate_update work is not canceled. For example, after bello=
w command:
quoted
echo 1 >/sys/block/sdb/bcache/detach
you can still see the writeback thread. Then you attach the device to th=
e cache again,
quoted
bcache will create another writeback thread, for example, after bellow c=
ommand:
quoted
echo  ba0fb5cd-658a-4533-9806-6ce166d883b9 > /sys/block/sdb/bcache/attac=
h
quoted
then you will see 2 writeback threads.
This patch stops writeback thread and cancels writeback_rate_update work=
 when cached
quoted
device detaching from cache.

Signed-off-by: Tang Junhui <redacted>
If the change can be inside bch_register_lock, it would (just) be more
comfortable. The code is correct, because attach/detach sysfs is created
after writeback_thread created and writeback_rate_update worker
initialized, even these resources are initialized within
bch_register_lock and released out of bch)register_lock in your patch,
there won't be any race. It's OK to me.
I think I agree with Coly that I'd prefer it to be moved down into the
register lock, as I think that will be safer with any future changes.
Are you willing to adjust it this way?

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