Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4346213pxb; Mon, 27 Sep 2021 15:08:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwf51VRI0zzfUBXoG+kP48qYklyOMSVah1rFGABs0cEN88MhWB+gQ2l0TaPW4Nzjg+h8WBS X-Received: by 2002:a05:6402:4307:: with SMTP id m7mr3198716edc.226.1632780486278; Mon, 27 Sep 2021 15:08:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632780486; cv=none; d=google.com; s=arc-20160816; b=yh3Z9HX5AZANsmnImAsdMWBubrFZCS/d6HyXndhWo7/vQwjY2saYlKaqtHkqGly5P4 r2CVTUpXldCHxidrBStVNTYm9UC0Sdyy+8InyjQ8OdNGfsp5Y2NZESV/pdP4rPI/XWIr q68MRmSmOLdHbDyZhOA0M5TMbnhbdhGtUMS6rlRsgU/QEhim9gjUYeuIiC9Z3hnGt5sK nbRkzh3tfGoxFqCh4sKjzcaHRzTKni+Uqi3CiWHlqn5hGIg4i0d6TFXiCSBHLdEhyJ94 llIkWPSuuRaOs9djD9J5dp1HKz7Qi6+yytelpTKAjmUxFa59y1RoSWfhvrN1OG+F8edi KEIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DqxnOIlBn7HOnLcVBtfbuHHKEj6aI4PsYWVAO4qKDFc=; b=GZakvNAAhlSgREPyrjUOBsx1KYXCAIrmey7GgsaMSi3k3UV+vXdcSz5z+QfoS1aOqP PYjAYzin8P9alhLprrDP/bA/2sgIpmpA2+Y6r8ROB0m98INGxcrCYLpdb27m+LsigxqP G9fjujppAxAwWNLeWWYqGjX+R7Hk5MKAYhnq/ExAXd5qYFBCOb6c3XLBuGjailKwDOS3 9CNJf8v9co8XWwq7Y48ePBQCedJ1ZoA0wTwZW5so+mTX+i3JVlJw+rbD+ZzlF6iUQnBt Eb74k/fbUPBmGMTXCH7KE03RgFLRbakx3OtnD6MSf5K/w8Ecy/OlO1Rv3xh4nHGw8LLq 5b6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=i6uXEICv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z12si3951712ejl.355.2021.09.27.15.07.43; Mon, 27 Sep 2021 15:08:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=i6uXEICv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237941AbhI0WHr (ORCPT + 99 others); Mon, 27 Sep 2021 18:07:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237703AbhI0WGh (ORCPT ); Mon, 27 Sep 2021 18:06:37 -0400 Received: from bombadil.infradead.org (unknown [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76A77C051749; Mon, 27 Sep 2021 15:03:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=DqxnOIlBn7HOnLcVBtfbuHHKEj6aI4PsYWVAO4qKDFc=; b=i6uXEICvlSpg7T5FMTnlp3aUuy xuk5iIy+cOhaN9U462dLuzHGkAlwF3BR6Iyh+YX9HJw8CR14PxvTGsmL/adh+RDRIUUzojYeo2IG1 qbTOtQD5Cc/ptacI37x2OnoL6AnEbTKstLCjpA/yYu+ZytEaHPmREt07wvHp6MVesvcBIXusKpkdL orqC6fO/j6PY1vK5m8OS2PRsmkOUofOPa0qIOO4yH4S1ex/fQI4e0deW+e5hDY/SOM39ZAf1eHvP7 U1V1OSUfutZlyqnGKowWeytxb/15571J81u7nKIq20Y3N/YncwOmJDWNkSk4aUsXmpgM3V7+4d4NM x/4C6pLA==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mUyiF-004VHu-E2; Mon, 27 Sep 2021 22:03:03 +0000 From: Luis Chamberlain To: axboe@kernel.dk, efremov@linux.com, hch@lst.de Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Luis Chamberlain Subject: [PATCH v2 02/14] floppy: fix add_disk() assumption on exit due to new developments Date: Mon, 27 Sep 2021 15:02:50 -0700 Message-Id: <20210927220302.1073499-3-mcgrof@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210927220302.1073499-1-mcgrof@kernel.org> References: <20210927220302.1073499-1-mcgrof@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.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 --- 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