Ming Lei
e6d1fa584e
sbitmap: order READ/WRITE freed instance and setting clear bit
Inside sbitmap_queue_clear(), once the clear bit is set, it will be
visiable to allocation path immediately. Meantime READ/WRITE on old
associated instance(such as request in case of blk-mq) may be
out-of-order with the setting clear bit, so race with re-allocation
may be triggered.
Adds one memory barrier for ordering READ/WRITE of the freed associated
instance with setting clear bit for avoiding race with re-allocation.
The following kernel oops triggerd by block/006 on aarch64 may be fixed:
[ 142.330954] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000330
[ 142.338794] Mem abort info:
[ 142.341554] ESR = 0x96000005
[ 142.344632] Exception class = DABT (current EL), IL = 32 bits
[ 142.350500] SET = 0, FnV = 0
[ 142.353544] EA = 0, S1PTW = 0
[ 142.356678] Data abort info:
[ 142.359528] ISV = 0, ISS = 0x00000005
[ 142.363343] CM = 0, WnR = 0
[ 142.366305] user pgtable: 64k pages, 48-bit VAs, pgdp = 000000002a3c51c0
[ 142.372983] [0000000000000330] pgd=0000000000000000, pud=0000000000000000
[ 142.379777] Internal error: Oops: 96000005 [#1] SMP
[ 142.384613] Modules linked in: null_blk ib_isert iscsi_target_mod ib_srpt target_core_mod ib_srp scsi_transport_srp vfat fat rpcrdma sunrpc rdma_ucm ib_iser rdma_cm iw_cm libiscsi ib_umad scsi_transport_iscsi ib_ipoib ib_cm mlx5_ib ib_uverbs ib_core sbsa_gwdt crct10dif_ce ghash_ce ipmi_ssif sha2_ce ipmi_devintf sha256_arm64 sg sha1_ce ipmi_msghandler ip_tables xfs libcrc32c mlx5_core sdhci_acpi mlxfw ahci_platform at803x sdhci libahci_platform qcom_emac mmc_core hdma hdma_mgmt i2c_dev [last unloaded: null_blk]
[ 142.429753] CPU: 7 PID: 1983 Comm: fio Not tainted 5.0.0.cki #2
[ 142.449458] pstate: 00400005 (nzcv daif +PAN -UAO)
[ 142.454239] pc : __blk_mq_free_request+0x4c/0xa8
[ 142.458830] lr : blk_mq_free_request+0xec/0x118
[ 142.463344] sp : ffff00003360f6a0
[ 142.466646] x29: ffff00003360f6a0 x28: ffff000010e70000
[ 142.471941] x27: ffff801729a50048 x26: 0000000000010000
[ 142.477232] x25: ffff00003360f954 x24: ffff7bdfff021440
[ 142.482529] x23: 0000000000000000 x22: 00000000ffffffff
[ 142.487830] x21: ffff801729810000 x20: 0000000000000000
[ 142.493123] x19: ffff801729a50000 x18: 0000000000000000
[ 142.498413] x17: 0000000000000000 x16: 0000000000000001
[ 142.503709] x15: 00000000000000ff x14: ffff7fe000000000
[ 142.509003] x13: ffff8017dcde09a0 x12: 0000000000000000
[ 142.514308] x11: 0000000000000001 x10: 0000000000000008
[ 142.519597] x9 : ffff8017dcde09a0 x8 : 0000000000002000
[ 142.524889] x7 : ffff8017dcde0a00 x6 : 000000015388f9be
[ 142.530187] x5 : 0000000000000001 x4 : 0000000000000000
[ 142.535478] x3 : 0000000000000000 x2 : 0000000000000000
[ 142.540777] x1 : 0000000000000001 x0 : ffff00001041b194
[ 142.546071] Process fio (pid: 1983, stack limit = 0x000000006460a0ea)
[ 142.552500] Call trace:
[ 142.554926] __blk_mq_free_request+0x4c/0xa8
[ 142.559181] blk_mq_free_request+0xec/0x118
[ 142.563352] blk_mq_end_request+0xfc/0x120
[ 142.567444] end_cmd+0x3c/0xa8 [null_blk]
[ 142.571434] null_complete_rq+0x20/0x30 [null_blk]
[ 142.576194] blk_mq_complete_request+0x108/0x148
[ 142.580797] null_handle_cmd+0x1d4/0x718 [null_blk]
[ 142.585662] null_queue_rq+0x60/0xa8 [null_blk]
[ 142.590171] blk_mq_try_issue_directly+0x148/0x280
[ 142.594949] blk_mq_try_issue_list_directly+0x9c/0x108
[ 142.600064] blk_mq_sched_insert_requests+0xb0/0xd0
[ 142.604926] blk_mq_flush_plug_list+0x16c/0x2a0
[ 142.609441] blk_flush_plug_list+0xec/0x118
[ 142.613608] blk_finish_plug+0x3c/0x4c
[ 142.617348] blkdev_direct_IO+0x3b4/0x428
[ 142.621336] generic_file_read_iter+0x84/0x180
[ 142.625761] blkdev_read_iter+0x50/0x78
[ 142.629579] aio_read.isra.6+0xf8/0x190
[ 142.633409] __io_submit_one.isra.8+0x148/0x738
[ 142.637912] io_submit_one.isra.9+0x88/0xb8
[ 142.642078] __arm64_sys_io_submit+0xe0/0x238
[ 142.646428] el0_svc_handler+0xa0/0x128
[ 142.650238] el0_svc+0x8/0xc
[ 142.653104] Code: b9402a63 f9000a7f 3100047f 540000a0 (f9419a81)
[ 142.659202] ---[ end trace 467586bc175eb09d ]---
Fixes: ea86ea2cdc
("sbitmap: ammortize cost of clearing bits")
Reported-and-bisected_and_tested-by: Yi Zhang <yi.zhang@redhat.com>
Cc: Yi Zhang <yi.zhang@redhat.com>
Cc: "jianchao.wang" <jianchao.w.wang@oracle.com>
Reviewed-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-03-25 13:05:47 -06:00
..
2017-11-02 11:10:55 +01:00
2018-12-19 10:42:08 +01:00
2019-02-06 11:01:57 +01:00
2018-10-31 08:54:14 -07:00
2019-03-07 18:32:03 -08:00
2018-08-07 17:51:39 +08:00
2019-03-15 14:37:46 -07:00
2018-07-10 15:00:52 -06:00
2018-10-02 08:44:59 +10:00
2015-09-10 13:29:01 -07:00
2018-10-31 08:54:13 -07:00
2018-03-26 02:01:27 +09:00
2018-08-22 10:52:48 -07:00
2018-06-12 16:19:22 -07:00
2017-12-01 13:09:40 -08:00
2017-12-01 13:09:40 -08:00
2017-12-08 15:13:27 +00:00
2019-03-07 18:32:00 -08:00
2017-07-14 15:05:13 -07:00
2018-06-21 14:25:21 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-10-12 09:17:46 +02:00
2019-01-03 18:57:57 -08:00
2019-02-13 08:16:41 +01:00
2018-03-14 16:55:29 -07:00
2018-08-16 12:14:42 -07:00
2018-03-09 16:40:01 -08:00
2018-11-30 07:22:05 +01:00
2018-11-20 14:26:55 +08:00
2017-11-02 11:10:55 +01:00
2016-03-13 23:55:13 -04:00
2017-11-02 11:10:55 +01:00
2017-09-08 18:26:49 -07:00
2017-12-01 13:09:40 -08:00
2017-11-02 11:10:55 +01:00
2018-11-29 17:30:48 +02:00
2015-05-27 15:22:15 +02:00
2019-03-12 10:04:02 -07:00
2017-09-26 15:01:20 -06:00
2017-09-26 15:01:20 -06:00
2019-02-15 19:50:07 +01:00
2018-07-27 19:04:33 +08:00
2017-02-24 17:46:57 -08:00
2018-08-22 10:52:48 -07:00
2018-01-08 10:08:33 +00:00
2015-05-26 15:26:43 +02:00
2018-09-14 14:08:52 +08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-10-19 07:53:18 +02:00
2018-12-28 12:11:45 -08:00
2018-06-12 23:33:24 +02:00
2018-07-27 19:16:38 +08:00
2017-11-02 11:10:55 +01:00
2017-02-24 17:46:57 -08:00
2015-09-10 13:29:01 -07:00
2015-09-10 13:29:01 -07:00
2015-09-10 13:29:01 -07:00
2017-11-02 11:10:55 +01:00
2019-01-31 19:28:40 +01:00
2017-10-12 17:16:40 +01:00
2019-03-07 18:32:00 -08:00
2018-03-15 13:25:36 +01:00
2019-03-07 18:32:00 -08:00
2017-11-15 11:56:19 -08:00
2016-06-08 11:04:19 +02:00
2018-01-12 17:33:38 -08:00
2018-04-27 08:51:26 -04:00
2017-07-10 16:32:35 -07:00
2017-08-10 15:54:06 -07:00
2019-01-04 13:13:46 -08:00
2018-02-06 18:32:44 -08:00
2017-11-02 11:10:55 +01:00
2018-11-12 14:26:21 -08:00
2018-07-27 19:04:33 +08:00
2018-12-29 11:36:44 -08:00
2019-01-05 13:54:53 -08:00
2019-03-12 10:04:02 -07:00
2017-02-24 17:46:57 -08:00
2017-02-24 17:46:57 -08:00
2017-09-08 18:26:49 -07:00
2017-11-02 11:10:55 +01:00
2018-10-21 10:46:44 -04:00
2017-11-02 11:10:55 +01:00
2019-01-21 07:20:18 +13:00
2018-06-12 16:19:22 -07:00
2016-01-20 17:09:18 -08:00
2019-01-22 13:39:59 +01:00
2018-05-09 06:55:44 +02:00
2018-12-28 12:11:50 -08:00
2019-02-26 14:05:20 -05:00
2019-02-19 20:52:19 -07:00
2017-03-02 08:42:38 +01:00
2017-11-02 11:10:55 +01:00
2019-01-03 08:21:02 -07:00
2019-03-10 17:48:21 -07:00
2019-03-05 21:07:13 -08:00
2017-05-16 08:44:22 -03:00
2019-03-07 18:32:02 -08:00
2018-06-12 16:19:22 -07:00
2018-07-02 16:20:23 -04:00
2019-01-22 14:25:26 +01:00
2019-01-22 14:25:26 +01:00
2018-10-31 08:54:13 -07:00
2017-11-02 11:10:55 +01:00
2018-03-26 15:09:38 +02:00
2018-04-11 10:28:35 -07:00
2017-11-02 11:10:55 +01:00
2017-10-25 11:01:08 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-02-28 07:55:43 +01:00
2018-04-12 09:41:19 -07:00
2018-03-21 17:18:34 -05:00
2018-06-12 16:19:22 -07:00
2017-12-01 13:09:40 -08:00
2019-03-14 02:36:04 +09:00
2018-10-16 13:45:44 +02:00
2017-11-02 11:10:55 +01:00
2017-12-01 13:09:40 -08:00
2017-11-02 11:10:55 +01:00
2015-12-03 11:49:23 -05:00
2018-10-08 10:39:04 -07:00
2018-07-09 14:10:40 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-02-14 12:41:54 -05:00
2017-12-08 15:13:28 +00:00
2017-11-04 09:26:51 +09:00
2017-02-03 16:35:42 -05:00
2018-10-31 08:54:12 -07:00
2018-01-26 11:45:16 -06:00
2018-08-30 12:56:40 +02:00
2018-11-27 09:21:45 -08:00
2017-03-02 08:42:27 +01:00
2017-01-23 09:17:12 +01:00
2018-12-06 08:26:16 -05:00
2017-11-21 15:57:05 -08:00
2017-10-03 17:54:26 -07:00
2017-11-02 11:10:55 +01:00
2018-06-12 16:19:22 -07:00
2017-12-14 16:00:48 -08:00
2018-07-07 01:45:31 +02:00
2019-02-04 09:03:31 +01:00
2019-02-22 13:49:00 +01:00
2019-03-25 13:05:47 -06:00
2019-02-11 15:02:33 -07:00
2018-12-22 08:21:03 -05:00
2018-10-31 08:54:13 -07:00
2015-08-24 14:28:01 -06:00
2017-11-02 11:10:55 +01:00
2018-04-13 17:10:28 -07:00
2018-12-28 12:11:49 -08:00
2017-01-09 13:58:57 -05:00
2019-02-13 08:16:40 +01:00
2017-11-02 11:10:55 +01:00
2018-02-06 18:32:44 -08:00
2017-09-13 18:53:16 -07:00
2018-10-16 13:45:44 +02:00
2019-01-04 12:56:09 -08:00
2019-01-04 12:56:09 -08:00
2017-11-02 11:10:55 +01:00
2018-06-27 18:58:49 +03:00
2018-05-18 17:17:12 -07:00
2019-02-25 22:18:07 +01:00
2018-12-17 22:12:30 +11:00
2019-03-07 18:32:00 -08:00
2016-09-01 17:52:01 -07:00
2018-11-30 12:13:15 -08:00
2018-10-15 16:31:29 -04:00
2019-03-05 21:07:13 -08:00
2019-02-01 15:46:23 -08:00
2017-11-17 16:10:01 -08:00
2018-10-16 13:45:44 +02:00
2019-02-13 22:13:29 -08:00
2018-08-08 09:47:26 -06:00
2017-02-26 11:03:38 -05:00
2018-12-10 22:39:34 +01:00
2019-02-22 13:49:00 +01:00
2017-01-09 13:58:57 -05:00
2018-02-06 18:32:45 -08:00
2019-03-04 09:29:52 -08:00
2015-08-03 11:51:12 +02:00
2016-02-09 10:27:29 +01:00
2017-11-17 16:10:01 -08:00
2017-07-12 16:26:00 -07:00
2019-03-07 18:32:00 -08:00
2018-03-26 15:55:57 +02:00
2017-07-21 09:38:30 +02:00
2019-03-05 21:07:15 -08:00
2019-02-21 17:54:44 -05:00
2015-09-10 13:29:01 -07:00
2016-02-03 08:28:43 -08:00
2018-04-16 18:53:13 -04:00
2017-12-29 23:13:10 +01:00
2017-10-22 03:14:07 +01:00
2017-10-22 03:14:07 +01:00
2018-11-18 10:15:10 -08:00
2018-02-06 18:32:46 -08:00
2018-04-23 16:39:35 +01:00
2018-06-07 17:34:39 -07:00
2019-01-03 18:57:57 -08:00
2017-12-11 15:03:08 -07:00
2019-03-09 09:22:42 -08:00
2017-11-02 11:10:55 +01:00
2019-02-21 17:54:44 -05:00
2017-08-15 09:02:07 -07:00