Patch "floppy: fix add_disk() assumption on exit due to new developments" 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

    floppy: fix add_disk() assumption on exit due to new developments

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:
     floppy-fix-add_disk-assumption-on-exit-due-to-new-de.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 d42f61d25d253c5de5d6d3941bae5cfdb24c169f
Author: Luis Chamberlain <mcgrof@xxxxxxxxxx>
Date:   Mon Sep 27 15:02:50 2021 -0700

    floppy: fix add_disk() assumption on exit due to new developments
    
    [ Upstream commit 2598a2bb357d64baaa94368133ddbc900b9eb246 ]
    
    After the patch titled "floppy: use blk_mq_alloc_disk and
    blk_cleanup_disk" the floppy driver was modified to allocate
    the blk_mq_alloc_disk() which allocates the disk with the
    queue. This is further clarified later with the patch titled
    "block: remove alloc_disk and alloc_disk_node". This clarifies
    that:
    
       Most drivers should use and have been converted to use
       blk_alloc_disk and blk_mq_alloc_disk.  Only the scsi
       ULPs and dasd still allocate a disk separately from the
       request_queue so don't bother with convenience macros for
       something that should not see significant new users and
       remove these wrappers.
    
    And then we have the patch titled, "block: hold a request_queue
    reference for the lifetime of struct gendisk" which ensures
    that a queue is *always* present for sure during the entire
    lifetime of a disk.
    
    In the floppy driver's case then the disk always comes with the
    queue. So even if even if the queue was cleaned up on exit, putting
    the disk *is* still required, and likewise, blk_cleanup_queue() on
    a null queue should not happen now as disk->queue is valid from
    disk allocation time on.
    
    Automatic backport code scrapers should hopefully not cherry pick
    this patch as a stable fix candidate without full due dilligence to
    ensure all the work done on the block layer to make this happen is
    merged first.
    
    Signed-off-by: Luis Chamberlain <mcgrof@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20210927220302.1073499-3-mcgrof@xxxxxxxxxx
    Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index fef79ea52e3ed..3e6390fd5f2be 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -4953,19 +4953,6 @@ static void __exit floppy_module_exit(void)
 				blk_cleanup_queue(disks[drive][i]->queue);
 		}
 		blk_mq_free_tag_set(&tag_sets[drive]);
-
-		/*
-		 * These disks have not called add_disk().  Don't put down
-		 * queue reference in put_disk().
-		 */
-		if (!(allowed_drive_mask & (1 << drive)) ||
-		    fdc_state[FDC(drive)].version == FDC_NONE) {
-			for (i = 0; i < ARRAY_SIZE(floppy_type); i++) {
-				if (disks[drive][i])
-					disks[drive][i]->queue = NULL;
-			}
-		}
-
 		for (i = 0; i < ARRAY_SIZE(floppy_type); i++) {
 			if (disks[drive][i])
 				put_disk(disks[drive][i]);



[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