Colin Ian King
1655cfc852
block, bfq: Fix division by zero error on zero wsum
...
[ Upstream commit e53413f8deedf738a6782cc14cc00bd5852ccf18 ]
When the weighted sum is zero the calculation of limit causes
a division by zero error. Fix this by continuing to the next level.
This was discovered by running as root:
stress-ng --ioprio 0
Fixes divison by error oops:
[ 521.450556] divide error: 0000 [#1 ] SMP NOPTI
[ 521.450766] CPU: 2 PID: 2684464 Comm: stress-ng-iopri Not tainted 6.2.1-1280.native #1
[ 521.451117] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.1-0-g3208b098f51a-prebuilt.qemu.org 04/01/2014
[ 521.451627] RIP: 0010:bfqq_request_over_limit+0x207/0x400
[ 521.451875] Code: 01 48 8d 0c c8 74 0b 48 8b 82 98 00 00 00 48 8d 0c c8 8b 85 34 ff ff ff 48 89 ca 41 0f af 41 50 48 d1 ea 48 98 48 01 d0 31 d2 <48> f7 f1 41 39 41 48 89 85 34 ff ff ff 0f 8c 7b 01 00 00 49 8b 44
[ 521.452699] RSP: 0018:ffffb1af84eb3948 EFLAGS: 00010046
[ 521.452938] RAX: 000000000000003c RBX: 0000000000000000 RCX: 0000000000000000
[ 521.453262] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffb1af84eb3978
[ 521.453584] RBP: ffffb1af84eb3a30 R08: 0000000000000001 R09: ffff8f88ab8a4ba0
[ 521.453905] R10: 0000000000000000 R11: 0000000000000001 R12: ffff8f88ab8a4b18
[ 521.454224] R13: ffff8f8699093000 R14: 0000000000000001 R15: ffffb1af84eb3970
[ 521.454549] FS: 00005640b6b0b580(0000) GS:ffff8f88b3880000(0000) knlGS:0000000000000000
[ 521.454912] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 521.455170] CR2: 00007ffcbcae4e38 CR3: 00000002e46de001 CR4: 0000000000770ee0
[ 521.455491] PKRU: 55555554
[ 521.455619] Call Trace:
[ 521.455736] <TASK>
[ 521.455837] ? bfq_request_merge+0x3a/0xc0
[ 521.456027] ? elv_merge+0x115/0x140
[ 521.456191] bfq_limit_depth+0xc8/0x240
[ 521.456366] __blk_mq_alloc_requests+0x21a/0x2c0
[ 521.456577] blk_mq_submit_bio+0x23c/0x6c0
[ 521.456766] __submit_bio+0xb8/0x140
[ 521.457236] submit_bio_noacct_nocheck+0x212/0x300
[ 521.457748] submit_bio_noacct+0x1a6/0x580
[ 521.458220] submit_bio+0x43/0x80
[ 521.458660] ext4_io_submit+0x23/0x80
[ 521.459116] ext4_do_writepages+0x40a/0xd00
[ 521.459596] ext4_writepages+0x65/0x100
[ 521.460050] do_writepages+0xb7/0x1c0
[ 521.460492] __filemap_fdatawrite_range+0xa6/0x100
[ 521.460979] file_write_and_wait_range+0xbf/0x140
[ 521.461452] ext4_sync_file+0x105/0x340
[ 521.461882] __x64_sys_fsync+0x67/0x100
[ 521.462305] ? syscall_exit_to_user_mode+0x2c/0x1c0
[ 521.462768] do_syscall_64+0x3b/0xc0
[ 521.463165] entry_SYSCALL_64_after_hwframe+0x5a/0xc4
[ 521.463621] RIP: 0033:0x5640b6c56590
[ 521.464006] Code: 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 80 3d 71 70 0e 00 00 74 17 b8 4a 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 48 c3 0f 1f 80 00 00 00 00 48 83 ec 18 89 7c
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20230413133009.1605335-1-colin.i.king@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-05-24 17:32:38 +01:00
..
2022-09-03 11:29:03 -06:00
2022-04-23 07:15:26 -06:00
2022-09-11 19:47:12 -05:00
2023-02-09 11:28:06 +01:00
2023-05-24 17:32:38 +01:00
2022-10-20 05:46:49 -07:00
2022-08-22 10:07:56 -06:00
2023-03-10 09:32:46 +01:00
2023-03-10 09:34:02 +01:00
2022-08-26 10:57:41 -10:00
2021-03-05 11:32:15 -07:00
2022-07-14 12:14:30 -06:00
2023-05-17 11:53:33 +02:00
2022-09-26 19:09:31 -06:00
2023-03-10 09:34:02 +01:00
2022-10-11 17:42:58 -06:00
2023-05-11 23:03:00 +09:00
2023-05-11 23:03:01 +09:00
2022-02-28 06:40:23 -07:00
2023-05-11 23:03:01 +09:00
2022-09-30 07:49:09 -06:00
2022-06-29 08:36:46 -06:00
2021-11-29 06:38:51 -07:00
2022-06-27 06:29:12 -06:00
2023-05-11 23:03:42 +09:00
2022-09-26 19:17:28 -06:00
2022-09-26 19:09:31 -06:00
2022-09-26 19:09:31 -06:00
2022-09-15 00:25:17 -06:00
2022-09-30 07:51:13 -06:00
2023-05-11 23:03:00 +09:00
2022-08-22 10:07:53 -06:00
2022-07-06 06:46:26 -06:00
2022-10-07 09:19:14 -07:00
2022-06-17 07:31:05 -06:00
2022-08-22 10:07:53 -06:00
2022-08-22 10:07:53 -06:00
2023-03-10 09:32:44 +01:00
2021-11-29 06:41:29 -07:00
2022-12-31 13:33:03 +01:00
2022-09-12 00:10:34 -06:00
2022-06-27 06:29:12 -06:00
2022-08-22 10:07:53 -06:00
2023-05-11 23:03:22 +09:00
2022-09-29 07:45:47 -06:00
2021-12-22 23:38:29 -05:00
2021-02-22 06:33:48 -07:00
2022-07-12 14:38:52 -06:00
2022-09-21 19:50:53 -06:00
2022-11-16 15:58:11 -07:00
2023-05-11 23:03:00 +09:00
2021-12-14 17:23:05 -07:00
2022-09-26 19:17:27 -06:00
2023-04-13 16:55:37 +02:00
2022-09-26 19:17:28 -06:00
2020-07-31 16:29:47 -06:00
2022-10-09 07:48:16 -06:00
2022-03-31 12:58:38 -06:00
2022-09-29 07:45:47 -06:00
2023-03-17 08:50:20 +01:00
2022-08-02 17:22:54 -06:00
2022-07-06 06:33:53 -06:00
2022-06-21 21:22:51 -04:00
2022-02-02 07:49:59 -07:00
2022-09-27 09:58:56 -06:00
2022-07-14 12:14:30 -06:00
2023-03-10 09:34:02 +01:00
2023-04-13 16:55:32 +02:00
2022-06-23 07:48:05 -06:00
2023-03-17 08:50:21 +01:00
2022-06-27 06:29:12 -06:00
2022-06-29 08:35:57 -06:00
2021-12-16 10:59:02 -07:00
2022-07-14 12:14:30 -06:00
2022-05-02 14:06:20 -06:00
2023-01-24 07:24:44 +01:00
2022-08-22 07:52:51 -06:00
2022-11-08 07:14:35 -07:00
2022-03-07 12:48:35 -07:00