linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: axboe@kernel.dk, efremov@linux.com, hch@lst.de
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	Luis Chamberlain <mcgrof@kernel.org>
Subject: [PATCH 02/14] floppy: fix add_disk() assumption on exit due to new developments
Date: Fri,  3 Sep 2021 18:35:24 -0700	[thread overview]
Message-ID: <20210904013536.3181237-3-mcgrof@kernel.org> (raw)
In-Reply-To: <20210904013536.3181237-1-mcgrof@kernel.org>

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@kernel.org>
---
 drivers/block/floppy.c | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index fef79ea52e3e..3e6390fd5f2b 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]);
-- 
2.30.2


  parent reply	other threads:[~2021-09-04  1:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-04  1:35 [PATCH 00/14] block: 6th batch of add_disk() error handling conversions Luis Chamberlain
2021-09-04  1:35 ` [PATCH 01/14] block/swim3: add error handling support for add_disk() Luis Chamberlain
2021-09-04  1:35 ` Luis Chamberlain [this message]
2021-09-04  1:35 ` [PATCH 03/14] floppy: use blk_cleanup_disk() Luis Chamberlain
2021-09-04  1:35 ` [PATCH 04/14] floppy: fix calling platform_device_unregister() on invalid drives Luis Chamberlain
2021-09-04  1:35 ` [PATCH 05/14] floppy: add error handling support for add_disk() Luis Chamberlain
2021-09-04  1:35 ` [PATCH 06/14] amiflop: " Luis Chamberlain
2021-09-04  1:35 ` [PATCH 07/14] swim: simplify using blk_cleanup_disk() on swim_remove() Luis Chamberlain
2021-09-04  1:35 ` [PATCH 08/14] swim: add helper for disk cleanup Luis Chamberlain
2021-09-04  1:35 ` [PATCH 09/14] swim: add a floppy registration bool which triggers del_gendisk() Luis Chamberlain
2021-09-04  1:35 ` [PATCH 10/14] swim: add error handling support for add_disk() Luis Chamberlain
2021-09-04  1:35 ` [PATCH 11/14] block/ataflop: use the blk_cleanup_disk() helper Luis Chamberlain
2021-09-04  1:35 ` [PATCH 12/14] block/ataflop: add registration bool before calling del_gendisk() Luis Chamberlain
2021-09-04  1:35 ` [PATCH 13/14] block/ataflop: provide a helper for cleanup up an atari disk Luis Chamberlain
2021-09-04  1:35 ` [PATCH 14/14] block/ataflop add error handling support for add_disk() Luis Chamberlain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210904013536.3181237-3-mcgrof@kernel.org \
    --to=mcgrof@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=efremov@linux.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).