]> Git Repo - linux.git/commit
block: flush the integrity workqueue in blk_integrity_unregister
authorLihong Kou <[email protected]>
Tue, 14 Sep 2021 07:06:56 +0000 (09:06 +0200)
committerJens Axboe <[email protected]>
Wed, 15 Sep 2021 02:03:30 +0000 (20:03 -0600)
commit3df49967f6f1d2121b0c27c381ca1c8386b1dab9
tree5f6e187a491835514d8960b668085b945f0686be
parent783a40a1b3ac7f3714d2776fa8ac8cce3535e4f6
block: flush the integrity workqueue in blk_integrity_unregister

When the integrity profile is unregistered there can still be integrity
reads queued up which could see a NULL verify_fn as shown by the race
window below:

CPU0                                    CPU1
  process_one_work                      nvme_validate_ns
    bio_integrity_verify_fn                nvme_update_ns_info
                                     nvme_update_disk_info
                                       blk_integrity_unregister
                                               ---set queue->integrity as 0
bio_integrity_process
--access bi->profile->verify_fn(bi is a pointer of queue->integity)

Before calling blk_integrity_unregister in nvme_update_disk_info, we must
make sure that there is no work item in the kintegrityd_wq. Just call
blk_flush_integrity to flush the work queue so the bug can be resolved.

Signed-off-by: Lihong Kou <[email protected]>
[hch: split up and shortened the changelog]
Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: Sagi Grimberg <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
block/blk-integrity.c
This page took 0.055492 seconds and 4 git commands to generate.