bcache: cannot set writeback_running via sysfs if no writeback kthread created
authorShenghui Wang <shhuiw@foxmail.com>
Thu, 13 Dec 2018 14:53:51 +0000 (22:53 +0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 13 Dec 2018 15:15:54 +0000 (08:15 -0700)
commitf383ae300c4b6466824fd5c8cbd0a6c4ed2b53d3
tree7e68c2e8cfd414d4c94f9493adb1335cfceeb925
parent79b791466e525c98f6aeee9acf5726e7b27f4231
bcache: cannot set writeback_running via sysfs if no writeback kthread created

"echo 1 > writeback_running" marks writeback_running even if no
writeback kthread created as "d_strtoul(writeback_running)" will simply
set dc-> writeback_running without checking the existence of
dc->writeback_thread.

Add check for setting writeback_running via sysfs: if no writeback
kthread available, reject setting to 1.

v2 -> v3:
  * Make message on wrong assignment more clear.
  * Print name of bcache device instead of name of backing device.

Signed-off-by: Shenghui Wang <shhuiw@foxmail.com>
Signed-off-by: Coly Li <colyli@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/bcache/sysfs.c