From patchwork Thu Jan 9 05:57:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13932062 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 161431FBEA6; Thu, 9 Jan 2025 05:58:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736402331; cv=none; b=eTBhyR3iHTVMu5aEZW18GReyUDiZeFTJnMl5RqpjffBEes3kedrsWpFmMfWZbNeWXvtGzllUbmwZMmbp0ghQWquVEUKnDXkZ8+2wn62c/6QWwl6eOwquoSH1UKQJsCpUyuRguzj4qTUfygrHyNcZiAT6oY5vT0KSUY2XRs/37yI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736402331; c=relaxed/simple; bh=0kQ/mO/HXAxNOUOAn/0qiPB+H+UsFLLrzj9uTGeDUI0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iZEOyI0DXIQkjZulTu5dF9ZDOaMYUc370l3PKF5k8KW9O0zx0+sqt4BfqApLl8GH5QfNZGnbSBH1ZkV6DEHuaazGdkWn0hDxhRf82tfgEEiFbEwm7lJiegxqty8fgLNUGgyc9fjqWwIbAeOOaEfnvRcopdOSsZIQg4um2nco2sY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=M3XHoOmA; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="M3XHoOmA" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=JR3bIJ3RlWlhBbScb5eoBT6/SsBtByww8ig4IH466+k=; b=M3XHoOmAgPIUi3euakQinYlL40 ElVQHTRvS8SNU772rXp+g4Ixnam98HFeel07pgi/BaCrs6fFBMjAdmCRyOeouOvZBVB05YL86UkSZ XT/eyUHP32M8EHb2jrKH6ly7TXlIrNnx8SV5DMKH/nRTttD1kEbm2WWO0oyXAZ+7TwnI8tSRXCu98 6lWNZIRNPmn6EGiA8QrSMjTGiuuB4ZuJLZAMFB7hXnWrcrDCvaEumBVDXT/4cLXO39rmsHCfiZTAK KcMFdhDle7OXFl6tnpjfNj65iWhs0zT64ctiSf1QEw7Vy4m4R4Qn9003GFSnMrb5yCfgVgasFJ+57 y5493A6Q==; Received: from 2a02-8389-2341-5b80-ddeb-cdec-70b9-e2f0.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:ddeb:cdec:70b9:e2f0] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.98 #2 (Red Hat Linux)) id 1tVlZ8-0000000ArZ1-2OQa; Thu, 09 Jan 2025 05:58:48 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Damien Le Moal , Ming Lei , Nilay Shroff , linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, nbd@other.debian.org, linux-scsi@vger.kernel.org, usb-storage@lists.one-eyed-alien.net, Johannes Thumshirn Subject: [PATCH 09/11] usb-storage: fix queue freeze vs limits lock order Date: Thu, 9 Jan 2025 06:57:30 +0100 Message-ID: <20250109055810.1402918-10-hch@lst.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250109055810.1402918-1-hch@lst.de> References: <20250109055810.1402918-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Match the locking order used by the core block code by only freezing the queue after taking the limits lock using the queue_limits_commit_update_frozen helper. Signed-off-by: Christoph Hellwig Reviewed-by: Ming Lei Reviewed-by: Damien Le Moal Reviewed-by: Nilay Shroff Reviewed-by: Johannes Thumshirn --- drivers/usb/storage/scsiglue.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 8c8b5e6041cc..dc98ceecb724 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c @@ -592,12 +592,9 @@ static ssize_t max_sectors_store(struct device *dev, struct device_attribute *at if (sscanf(buf, "%hu", &ms) <= 0) return -EINVAL; - blk_mq_freeze_queue(sdev->request_queue); lim = queue_limits_start_update(sdev->request_queue); lim.max_hw_sectors = ms; - ret = queue_limits_commit_update(sdev->request_queue, &lim); - blk_mq_unfreeze_queue(sdev->request_queue); - + ret = queue_limits_commit_update_frozen(sdev->request_queue, &lim); if (ret) return ret; return count;