Skip to content

Commit fa09ca5

Browse files
committed
Merge tag 'block-5.16-2021-12-17' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe: - Fix for hammering on the delayed run queue timer (me) - bcache regression fix for this merge window (Lin) - Fix a divide-by-zero in the blk-iocost code (Tejun) * tag 'block-5.16-2021-12-17' of git://git.kernel.dk/linux-block: bcache: fix NULL pointer reference in cached_dev_detach_finish block: reduce kblockd_mod_delayed_work_on() CPU consumption iocost: Fix divide-by-zero on donation from low hweight cgroup
2 parents cb29eee + aa97f6c commit fa09ca5

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

block/blk-core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,6 +1484,8 @@ EXPORT_SYMBOL(kblockd_schedule_work);
14841484
int kblockd_mod_delayed_work_on(int cpu, struct delayed_work *dwork,
14851485
unsigned long delay)
14861486
{
1487+
if (!delay)
1488+
return queue_work_on(cpu, kblockd_workqueue, &dwork->work);
14871489
return mod_delayed_work_on(cpu, kblockd_workqueue, dwork, delay);
14881490
}
14891491
EXPORT_SYMBOL(kblockd_mod_delayed_work_on);

block/blk-iocost.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2311,7 +2311,14 @@ static void ioc_timer_fn(struct timer_list *timer)
23112311
hwm = current_hweight_max(iocg);
23122312
new_hwi = hweight_after_donation(iocg, old_hwi, hwm,
23132313
usage, &now);
2314-
if (new_hwi < hwm) {
2314+
/*
2315+
* Donation calculation assumes hweight_after_donation
2316+
* to be positive, a condition that a donor w/ hwa < 2
2317+
* can't meet. Don't bother with donation if hwa is
2318+
* below 2. It's not gonna make a meaningful difference
2319+
* anyway.
2320+
*/
2321+
if (new_hwi < hwm && hwa >= 2) {
23152322
iocg->hweight_donating = hwa;
23162323
iocg->hweight_after_donation = new_hwi;
23172324
list_add(&iocg->surplus_list, &surpluses);

drivers/md/bcache/super.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,7 @@ static void cancel_writeback_rate_update_dwork(struct cached_dev *dc)
11391139
static void cached_dev_detach_finish(struct work_struct *w)
11401140
{
11411141
struct cached_dev *dc = container_of(w, struct cached_dev, detach);
1142+
struct cache_set *c = dc->disk.c;
11421143

11431144
BUG_ON(!test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags));
11441145
BUG_ON(refcount_read(&dc->count));
@@ -1156,7 +1157,7 @@ static void cached_dev_detach_finish(struct work_struct *w)
11561157

11571158
bcache_device_detach(&dc->disk);
11581159
list_move(&dc->list, &uncached_devices);
1159-
calc_cached_dev_sectors(dc->disk.c);
1160+
calc_cached_dev_sectors(c);
11601161

11611162
clear_bit(BCACHE_DEV_DETACHING, &dc->disk.flags);
11621163
clear_bit(BCACHE_DEV_UNLINK_DONE, &dc->disk.flags);

0 commit comments

Comments
 (0)