Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3902279ybz; Mon, 4 May 2020 11:49:26 -0700 (PDT) X-Google-Smtp-Source: APiQypKh8fz+s/kJYFtkUc+EpJACY+j2XZdoTb69XRrKcF3Gr/VoxsXn1BW2puwX+dbtK/51vHG0 X-Received: by 2002:a17:906:534b:: with SMTP id j11mr15684747ejo.142.1588618166441; Mon, 04 May 2020 11:49:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588618166; cv=none; d=google.com; s=arc-20160816; b=UPS9OdvLInUg2uyXjz1PLR3kds7ZNBzBO+eb1dd4YLrzjuQgF/DCvaCjXuNgn2BJPk +p0y9umARteG08ZWu78Z0zO7kUct8mR3Byn1ckft4Hz2dIRfq+v7UbbarV0WgI8mAI7F EIBqrdd1+TpQ/kYPr1suRfuT2DHgNCDlg4jXzG475sZzDO/IsGvGV995Wvj3phnSyf2F ZfFbHGt2MwNBfVk9mAooQmvRJElT+/YvabB3uQlVEs94OVjUq79ErJ00np42re5pLX4m Ww0Sr2Ddh8mnaJE8KKXEfVtnqfRyzs0Oewtuex15WNdgTyd0uaMuVqIqTBDn7y0PbNCL Uobg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=94Rq09jCDlv6ArvuXPHki1SezltCDWxGrJZjlxgEqgI=; b=ueuaqRHlq1weIZrRYm/foCuwNkXLRB+FdAmXFc5xkvHmW/oVhqEKzZw4QatoKFaCEk 27j+Oxorif+miYELpzbTo3d+8d9r0NY+OtNLS3yqQynRsrGz2rdawRJ2Og6vLMG2NFru T5xE3Q0CpytdnsBL4ghuyIeoosrCF2xYE3av4Gyui06DaU4a0vs1WU701KY3GlhZWM+m u653f8LJc6dUAxO1w93PLr3cSIrW4dxRNZBTs6P2krRaI3gzc/D+MvQwyddVNVuP9cJh 0VveuyUXrBJq0jQPw2FqfWnit1zc6vEmCwMFV8ykGY4iZvXwSE82Zz+rZr16rSlTqySB owsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CSmmExwG; 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 a19si7160623edr.254.2020.05.04.11.49.02; Mon, 04 May 2020 11:49:26 -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=@kernel.org header.s=default header.b=CSmmExwG; 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 S1732197AbgEDSHu (ORCPT + 99 others); Mon, 4 May 2020 14:07:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:38846 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732192AbgEDSHt (ORCPT ); Mon, 4 May 2020 14:07:49 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 63C3A20721; Mon, 4 May 2020 18:07:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588615668; bh=5Hg05jQx9fKm4esxgnrhIs8kDmBvvcdpoQ+ZqfQAQVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CSmmExwGUz9Dm8TBiDGJBKr0K5uTRc8axRDLqAYmYhUe1GHKJeEBfg2MTTrd7J+nx x3iP1eBCumZlT5hTGiappfxrVyFfYlTov3zPdlbDfAnXB3SR+9X4aVt4vAE064Dym9 QAM2SpBzRVVOn993nBH4XqW3I9DqQ6bDUi32r4qI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Michal=20Koutn=C3=BD?= , Yang Xu , Christoph Hellwig , Jens Axboe Subject: [PATCH 5.6 40/73] block: remove the bd_openers checks in blk_drop_partitions Date: Mon, 4 May 2020 19:57:43 +0200 Message-Id: <20200504165508.013010361@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200504165501.781878940@linuxfoundation.org> References: <20200504165501.781878940@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christoph Hellwig commit 10c70d95c0f2f9a6f52d0e33243d2877370cef51 upstream. When replacing the bd_super check with a bd_openers I followed a logical conclusion, which turns out to be utterly wrong. When a block device has bd_super sets it has a mount file system on it (although not every mounted file system sets bd_super), but that also implies it doesn't even have partitions to start with. So instead of trying to come up with a logical check for all openers, just remove the check entirely. Fixes: d3ef5536274f ("block: fix busy device checking in blk_drop_partitions") Fixes: cb6b771b05c3 ("block: fix busy device checking in blk_drop_partitions again") Reported-by: Michal Koutný Reported-by: Yang Xu Signed-off-by: Christoph Hellwig Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/partition-generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/block/partition-generic.c +++ b/block/partition-generic.c @@ -468,7 +468,7 @@ int blk_drop_partitions(struct gendisk * if (!disk_part_scan_enabled(disk)) return 0; - if (bdev->bd_part_count || bdev->bd_openers > 1) + if (bdev->bd_part_count) return -EBUSY; res = invalidate_partition(disk, 0); if (res)