Patch "block: flush the integrity workqueue in blk_integrity_unregister" has been added to the 5.14-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    block: flush the integrity workqueue in blk_integrity_unregister

to the 5.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     block-flush-the-integrity-workqueue-in-blk_integrity.patch
and it can be found in the queue-5.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 725400c5318c24b36514d6df734924cd8db86056
Author: Lihong Kou <koulihong@xxxxxxxxxx>
Date:   Tue Sep 14 09:06:56 2021 +0200

    block: flush the integrity workqueue in blk_integrity_unregister
    
    [ Upstream commit 3df49967f6f1d2121b0c27c381ca1c8386b1dab9 ]
    
    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 <koulihong@xxxxxxxxxx>
    [hch: split up and shortened the changelog]
    Signed-off-by: Christoph Hellwig <hch@xxxxxx>
    Reviewed-by: Sagi Grimberg <sagi@xxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20210914070657.87677-3-hch@xxxxxx
    Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index e9f943de377a..9e83159f5a52 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -430,6 +430,9 @@ void blk_integrity_unregister(struct gendisk *disk)
 
 	if (!bi->profile)
 		return;
+
+	/* ensure all bios are off the integrity workqueue */
+	blk_flush_integrity();
 	blk_queue_flag_clear(QUEUE_FLAG_STABLE_WRITES, disk->queue);
 	memset(bi, 0, sizeof(*bi));
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux