Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1724306ybz; Sat, 18 Apr 2020 07:12:54 -0700 (PDT) X-Google-Smtp-Source: APiQypLyywDcUm1XKN/Tda7aQ/RxibxGc/10axPWIYwqZWwxWNcK/jC3AjUpMldpsPGNTZb+abkS X-Received: by 2002:a17:906:2f15:: with SMTP id v21mr7688269eji.329.1587219174319; Sat, 18 Apr 2020 07:12:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587219174; cv=none; d=google.com; s=arc-20160816; b=HRnGqpPxIqblaGtweZlzZnbgHlDY8MxkxjiKlHHuhb4DayTl7BJtAEqzh94svbYRZk 3IHzC1Cl14YYSZnjCyxiFjOWvoWgvqCozM3ecIZT4qlDAFkLvA5wZWyxwanvRluEqUFR 3C2rw7mkZDMPtSnHlpOAHNEVyzZH3u0XynWD/Sw+Ucb/3hnA5HkJvTETZpKpSiweAjrU dSAJyQYGYUkN9ocFOP5Lv6wOGkwWJ+WKfPqPLwWnmd29ytyYAOeC+rKIXZRo+X8dL7Iu C4FvNHnLbbiLda2gb1aZKC/5TmYmUynXY1tpDU9K+uOI8Pw+Ip0jm3lN4yug3zSpOmxr 2z1Q== 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=UmvdlMvtL0dI0mgwKxxF2Oml3RJCft4lUHgNigTjBII=; b=ZcjESeHxxftaum2p5hmH8CFBBy8JllW2N3VJQ59z5erJhK2yRjdeR9xGwFSYWYnR2V rpkYCKnyTo1aOkaSXb1Qc3GsaKf+FYQPbxtczS4ptD9+W6x7eUXa7jEGOueDuIOWKTbs +O3e2C04fWrcRT/BH+T/713YIQEOnrAbPMz21p0U2h4nllOCQ4LxG8nt2ewfsfyEcZA1 ndEfe4e7sIKuQsjj3eNnwbhaQEnrNhbDJyxB/HObU0k9IQijcfCsTbEPTXY+oGLaGntd mPE1705Pj28S9Hh/TaNG/aYpJLD7lSVW9h26F58pvWiXJaEETSq0X5xGmLrCXigVisR7 Yqfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Uwf//iDQ"; 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 n19si8129792edq.264.2020.04.18.07.12.32; Sat, 18 Apr 2020 07:12:54 -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="Uwf//iDQ"; 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 S1728036AbgDROLD (ORCPT + 99 others); Sat, 18 Apr 2020 10:11:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:39110 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727963AbgDROKn (ORCPT ); Sat, 18 Apr 2020 10:10:43 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3341921D6C; Sat, 18 Apr 2020 14:10:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587219043; bh=zD789dP6I9c4Z+1f02WB1iPpEHekSNenlssybZAeuw0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uwf//iDQQHmX0KoOaTnJoi7txlixRZEZiId/k4o6QZFx3FjDAjtBHJdtgVLo2ErX9 b2k5n6B6ikgnf11YQW+TTxFad1X2kpMcKRBlnzj37gV10cSS3x2Gm8dAtUk7ab6K7x uxTqFi/cpDNLCiLStVlNjmf+IWScD1DPjXTjj0a4= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Christoph Hellwig , Qian Cai , Jens Axboe , Sasha Levin , linux-block@vger.kernel.org Subject: [PATCH AUTOSEL 5.5 75/75] block: fix busy device checking in blk_drop_partitions again Date: Sat, 18 Apr 2020 10:09:10 -0400 Message-Id: <20200418140910.8280-75-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200418140910.8280-1-sashal@kernel.org> References: <20200418140910.8280-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 [ Upstream commit cb6b771b05c3026a85ed4817c1b87c5e6f41d136 ] The previous fix had an off by one in the bd_openers checking, counting the callers blkdev_get. Fixes: d3ef5536274f ("block: fix busy device checking in blk_drop_partitions") Reported-by: Qian Cai Signed-off-by: Christoph Hellwig Tested-by: Qian Cai Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- block/partition-generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/partition-generic.c b/block/partition-generic.c index 5f3b2a959aa51..ebe4c2e9834bd 100644 --- a/block/partition-generic.c +++ b/block/partition-generic.c @@ -468,7 +468,7 @@ int blk_drop_partitions(struct gendisk *disk, struct block_device *bdev) if (!disk_part_scan_enabled(disk)) return 0; - if (bdev->bd_part_count || bdev->bd_openers) + if (bdev->bd_part_count || bdev->bd_openers > 1) return -EBUSY; res = invalidate_partition(disk, 0); if (res) -- 2.20.1