Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3442311pxa; Tue, 25 Aug 2020 23:47:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKNox48ni3AJnUdBuklnqm1TEkhXMH8ho2N+1G5+KKIc1CA1/wmtobK/0bJDxcH2ipfKnn X-Received: by 2002:a17:906:5811:: with SMTP id m17mr14038806ejq.40.1598424463882; Tue, 25 Aug 2020 23:47:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598424463; cv=none; d=google.com; s=arc-20160816; b=UBDbHb9HIuc90Zcpi4k6P8PEW9JFpFvrO2lK5mNn5//0Q9cyf9tKySIgd+pLi/62Dr LwusRIeoekQWgJ9fvc/nEqmTxzKilhQ3COPl3IKeYof/6Cr75GMndK5A2OYjxiNxjTQC l/D2GPhhkqk7BRfvX+cjEt1fNsTU701EIedroVWk6VK9R2FRB4QV3wKoSZzrEPmESxHX 32eSj/jESf0s7++CSqmjk9CCfPCDLEItATDEtwvGsxXc7oJDiCY6iODOVdmYmhtPL26C ovck/BqsU1QjKlPSDv3nRC/7pDliKV6NzW+bAq6Rc85LtrYVREARUmRUkHalemqznIMj D5qQ== 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=fsJnsxp6Lv7GfuelQJCt9no0qZxkObiCeO/OIGyJg2A=; b=eXyvzCuYTDy4Y7cU0iHPnTG7QXsDwMGX6Q2gZROcP6BV6EkPX4alcY5J7VixYcupuf OLZAwSNHrZ8DN0Rk//abOXwCv7//GcVe6nZzCWhVzFmLGHsjZ/CPA0hF2LNUO0QIiM/S WtEvi6cC8owwQafni5jZPPY7y/yeA7Yps7kACQtEej2tcBj3RPQw9Jypz9Kef7/uCpFY 1zVZdEcpx4hqWPVasW9W+DN/zFzAnK46STSBpwPp+tK2BOqL67OAmcSUXp/YmtS9YNkH 26JIgKbvraquh058EZbdXDT1WM9W6QJIIA5XQkr/RJjTVM0GqJp7wJDDcP2l0UNis80I SrFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=qbnJCv7I; 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 x2si885021edj.273.2020.08.25.23.47.19; Tue, 25 Aug 2020 23:47:43 -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=qbnJCv7I; 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 S1726240AbgHZGqp (ORCPT + 99 others); Wed, 26 Aug 2020 02:46:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726014AbgHZGqo (ORCPT ); Wed, 26 Aug 2020 02:46:44 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18C51C061574; Tue, 25 Aug 2020 23:46:44 -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=fsJnsxp6Lv7GfuelQJCt9no0qZxkObiCeO/OIGyJg2A=; b=qbnJCv7Iv64K+4ANXeV+pz4CQx qteaJldANyblscmlsgt75xRTbSCBFA1q5HSCtn1jhFLqtCWfLj6b3Biiozjh+2XDTE8SYtdmluKXX yH0rVJhqDyY9rav/e+5qXcYi/z3nlVkihLZ+2uLpqvFdUUtD/Xum0+ZdPrwwaWJqO4xusNov5FL9G r2Ul54B5p4Wwlix9LuHtd44fbNtxbx6lgLUbWstPZi6sdOzctqi70lyPxKZkOVJTMN+9yGEfnc3/V 8Erohtba1m/j6CpXO/cssXIvT5WVSHPTY9mRs9gMxFeyR3BmksL7Wp61A+0mdwuQiz/NqQRQn2Vds rOglIGgw==; Received: from 213-225-6-196.nat.highway.a1.net ([213.225.6.196] helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kApCh-0002ks-8p; Wed, 26 Aug 2020 06:46:39 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Denis Efremov , "David S. Miller" , Song Liu , Al Viro , 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: Wed, 26 Aug 2020 08:24:36 +0200 Message-Id: <20200826062446.31860-10-hch@lst.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200826062446.31860-1-hch@lst.de> References: <20200826062446.31860-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 95018e650f2d0c..ece87b1aab1b78 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; } /* @@ -3479,9 +3477,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); @@ -3671,11 +3666,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) @@ -3748,10 +3741,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