Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp359370pxk; Thu, 3 Sep 2020 01:18:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1pVI0G1AwcM6WrRE0ytv2j9nDz5VdTawz/iivoZ6L6CXZa033rzhKU707mBZBBRucvZK5 X-Received: by 2002:a17:906:3791:: with SMTP id n17mr945432ejc.216.1599121099100; Thu, 03 Sep 2020 01:18:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599121099; cv=none; d=google.com; s=arc-20160816; b=GZ9qN6naJGxCtBxTDGpmyVPNzMoNKuBRJIfeJvyzg2eSVrJUod83E3IHAj5o2hSOwy o9IpFmkP5fQ//p4IvSnWDRp1sqfR6Yr27ajmq7+tJwlyXhgjgHxgJY2rH7I451a8diKG GiqALVbIsnkFIeSOL2bGLxH29RxCAne2EN6+JotVNN2Dh2Antv+5RPt7SoFHPwi4wMhq y4wKqnynZYqZboGhSgdDjW2/ReH/aLONZIWEkoWJ/8DbKTZGXGhXqQ8qoOdByofMZ1Aq GrslBN+gRrt5H5QS8f2V/5l82DXRJn5LGnqvIfC19+mPGOOYsBjGE0+PgSgHV9xkyQ96 T87A== 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=jtS62lQ0Rm8mpaW0OdPDrzysFsFYBLY+VRU8MHAlSxE=; b=plGaOR7T4T0Je2jXyL2V6AeflECwzn/00KKQF4VrCJhb84dtelU/xti5QkAhPjFpMP Ss72tnr8Tz8ic5Y/Hc35tu+Iu7Ikzder6POOQWYrwRUgmPnRb5h2qZ3m8pdtBJfeBEaO XXuDC0CdDx1sGet3euvG+BtpBq/MscBgQ6kNQG81kpu7dNJ9IW4U/53MrEEmUHWQcSi0 pxdxQ8TH2L7lkdvYOXIBGpmK3LntRtoNZJfURue+LYofiQV0Yh99FZ5ZU4Tu0xr/exex Hj9/bcmUl5oi0agSdhXeB0YSEOK5qp03HzEAIGlPEAmG/t7N7Ku3s2w2B9E15hl+ucm8 1Dtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=KFoHKJIn; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s7si1178239edj.515.2020.09.03.01.17.55; Thu, 03 Sep 2020 01:18:19 -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=fail header.i=@infradead.org header.s=casper.20170209 header.b=KFoHKJIn; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728474AbgICIPI (ORCPT + 99 others); Thu, 3 Sep 2020 04:15:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728280AbgICIBj (ORCPT ); Thu, 3 Sep 2020 04:01:39 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 363B0C061245; Thu, 3 Sep 2020 01:01:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=jtS62lQ0Rm8mpaW0OdPDrzysFsFYBLY+VRU8MHAlSxE=; b=KFoHKJIntr7HYs+GfXiVXMrydl u16r7jFZuBANNgpX4jFo0Yd1h0BICAJwVVjJ1GGFBaiHgOXQToB7uwSp1c4rpnu55LfhHmnTUr/I3 96JMJCBua8BT/hsCfaMcf96vAkpcfCUxfCejuQN34FoZ8GPBNF3H1JwHmnAve95NtABOe9Elg1LPg OI0Uf51wlkU6xXig7Hb1qLBOl1DSov2nlLalbe0bl3z70gfDT9FVHradEDJ5Bx7ZrvMy6ur2ZxnuY 5jH1/ixX8IWNfBI9ICzHVPNAawlIBjbHJ00OkTyuxk5bhNQp0hd0rk7zCs9DCPTfRyrYtvHY+7aHx JLGPtaHw==; Received: from [2001:4bb8:184:af1:c70:4a89:bc61:2] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDkBZ-0006bg-L2; Thu, 03 Sep 2020 08:01:33 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Denis Efremov , "David S. Miller" , Song Liu , Al Viro , Finn Thain , Michael Schmitz , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org, linux-raid@vger.kernel.org, linux-scsi@vger.kernel.org, linux-m68k@lists.linux-m68k.org Subject: [PATCH 09/19] sd: use __register_blkdev to avoid a modprobe for an unregistered dev_t Date: Thu, 3 Sep 2020 10:01:09 +0200 Message-Id: <20200903080119.441674-10-hch@lst.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200903080119.441674-1-hch@lst.de> References: <20200903080119.441674-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Switch from using blk_register_region to the probe callback passed to __register_blkdev to disable the request_module call for an unclaimed dev_t in the SD majors. Signed-off-by: Christoph Hellwig --- drivers/scsi/sd.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 2bec8cd526164d..97bf84b1871571 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -596,13 +596,11 @@ static struct scsi_driver sd_template = { }; /* - * Dummy kobj_map->probe function. - * The default ->probe function will call modprobe, which is - * pointless as this module is already loaded. + * Don't request a new module, as that could deadlock in multipath + * environment. */ -static struct kobject *sd_default_probe(dev_t devt, int *partno, void *data) +static void sd_default_probe(dev_t devt) { - return NULL; } /* @@ -3481,9 +3479,6 @@ static int sd_remove(struct device *dev) free_opal_dev(sdkp->opal_dev); - blk_register_region(devt, SD_MINORS, NULL, - sd_default_probe, NULL, NULL); - mutex_lock(&sd_ref_mutex); dev_set_drvdata(dev, NULL); put_device(&sdkp->dev); @@ -3673,11 +3668,9 @@ static int __init init_sd(void) SCSI_LOG_HLQUEUE(3, printk("init_sd: sd driver entry point\n")); for (i = 0; i < SD_MAJORS; i++) { - if (register_blkdev(sd_major(i), "sd") != 0) + if (__register_blkdev(sd_major(i), "sd", sd_default_probe)) continue; majors++; - blk_register_region(sd_major(i), SD_MINORS, NULL, - sd_default_probe, NULL, NULL); } if (!majors) @@ -3750,10 +3743,8 @@ static void __exit exit_sd(void) class_unregister(&sd_disk_class); - for (i = 0; i < SD_MAJORS; i++) { - blk_unregister_region(sd_major(i), SD_MINORS); + for (i = 0; i < SD_MAJORS; i++) unregister_blkdev(sd_major(i), "sd"); - } } module_init(init_sd); -- 2.28.0