summaryrefslogtreecommitdiff
path: root/drivers/md/bcache/sysfs.c
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2019-08-16 16:40:08 +0200
committerStefan Agner <stefan.agner@toradex.com>2019-08-16 16:40:08 +0200
commit3758b8bd81966b63dc93093a323e9bdd734545fd (patch)
tree229bda2abe1a31d59da4b48e71aeefde934fe1d0 /drivers/md/bcache/sysfs.c
parentd15d0b7a9f89cf5a905ad6802eb23100c8063939 (diff)
parentdd209b062b86dd951cf1da93f20aa497fe99d52d (diff)
Merge tag 'v4.19.59-rt24' into toradex_4.19.y-rttoradex_4.19.y-rt
Linux 4.19.59-rt24
Diffstat (limited to 'drivers/md/bcache/sysfs.c')
-rw-r--r--drivers/md/bcache/sysfs.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c
index d9481640b3e1..541454b4f479 100644
--- a/drivers/md/bcache/sysfs.c
+++ b/drivers/md/bcache/sysfs.c
@@ -393,8 +393,13 @@ STORE(bch_cached_dev)
if (attr == &sysfs_writeback_running)
bch_writeback_queue(dc);
+ /*
+ * Only set BCACHE_DEV_WB_RUNNING when cached device attached to
+ * a cache set, otherwise it doesn't make sense.
+ */
if (attr == &sysfs_writeback_percent)
- if (!test_and_set_bit(BCACHE_DEV_WB_RUNNING, &dc->disk.flags))
+ if ((dc->disk.c != NULL) &&
+ (!test_and_set_bit(BCACHE_DEV_WB_RUNNING, &dc->disk.flags)))
schedule_delayed_work(&dc->writeback_rate_update,
dc->writeback_rate_update_seconds * HZ);