Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp11094ybt; Tue, 23 Jun 2020 13:57:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxR60QrGuZTbQ5Mse+1OWAUAOGXOujHL+b5ney5TIs09xB6jEAvJ+WKg3LmYM49Ki57zu2m X-Received: by 2002:a17:906:8316:: with SMTP id j22mr4620739ejx.97.1592945856744; Tue, 23 Jun 2020 13:57:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592945856; cv=none; d=google.com; s=arc-20160816; b=I942TJxZZlJKrZi8rFVTSSyar9wZFrMf59VgDqaMLPeKBFJRANUO459kLsSFQjQzEm GyG6EXHmyktP0JcH4ynuhT8rvF53BfhUhkFsfmxHjwhNH0QzIqg6a9J+aKWDJAZWWKwU p0ahSC7GXOn35eLo/t+Ts5HSjJow9VRfdo+faF2YOdi9vlfjTL5+eIWkSU+1uQZC0dYu XDbgJO4oP6ZFqG+3WSsHddQmkFCxTwddpkEv18abzvMtUS+YqhcYzn1iWQ8gPLW3QnkQ J3eFXK51xC+yeoS1XY3e9AgRmTV+wQc6kauKMfhgbs2vw1dppM/LlmwlnxYqdHnZQ5Ju 7P7Q== 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=/a+/X4ddFil2qkY8xHiOOww/LGoUDLlI+Mywvo52dRQ=; b=aHJdFneZwMi5T36NuS1waSx9tLxIoBKbNZgPbg71CIEh+pY0t/tWyjZNK4VUSifwOr Ji5qt+qOnz/Kr2m8rCRQUKpjruTjlLBRjYDva9qqkdkR4VWyrrU4s3Uzz+P8sG8PWbV6 a+XPBEThXMJO/MogdwgsQDFCNWG7vTYHNS0vOGJZMrcO5NO/RHmna30MV5bjPSXqCJqZ cLLR/oSvOatePVmCMieBAcLiCshGqywKLrrhYK9aJK7O0F+mFd1f2RjE1v88bAwlBcqE zhPbsFC+oEQvFLmDKg+AvqJ/ENEfkHi3TVhiHv1sszncpnh9kmGncbNXZMd13W8O3Dj1 51Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OzTq1cJ5; 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 zn5si3648548ejb.583.2020.06.23.13.57.13; Tue, 23 Jun 2020 13:57:36 -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=OzTq1cJ5; 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 S2403967AbgFWUoJ (ORCPT + 99 others); Tue, 23 Jun 2020 16:44:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:41166 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403965AbgFWUoH (ORCPT ); Tue, 23 Jun 2020 16:44:07 -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 A4A002070E; Tue, 23 Jun 2020 20:44:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592945047; bh=Ue0UmwVWigaMg1k0SBFBFVuMmyzebbHag0LR1QUwES8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OzTq1cJ5edBoCgcPX1dILDazTEfiIyBbeCzBuDUVyJcLpgSgQAz1Z32IQkg3QR7uK fX3sZFEABEbobWpDFT+57zCcHcuKI4EpSCYJTJISp+r6kOvmYAHrmm9lgYp3Gfw8wR 7bA94joBpywwV7cTt3Ew+xBKkl2CzFkBK/IC2JMo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Wilck , Hannes Reinecke , Mike Snitzer , Sasha Levin Subject: [PATCH 4.14 019/136] dm mpath: switch paths in dm_blk_ioctl() code path Date: Tue, 23 Jun 2020 21:57:55 +0200 Message-Id: <20200623195304.580822821@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195303.601828702@linuxfoundation.org> References: <20200623195303.601828702@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: Martin Wilck [ Upstream commit 2361ae595352dec015d14292f1b539242d8446d6 ] SCSI LUN passthrough code such as qemu's "scsi-block" device model pass every IO to the host via SG_IO ioctls. Currently, dm-multipath calls choose_pgpath() only in the block IO code path, not in the ioctl code path (unless current_pgpath is NULL). This has the effect that no path switching and thus no load balancing is done for SCSI-passthrough IO, unless the active path fails. Fix this by using the same logic in multipath_prepare_ioctl() as in multipath_clone_and_map(). Note: The allegedly best path selection algorithm, service-time, still wouldn't work perfectly, because the io size of the current request is always set to 0. Changing that for the IO passthrough case would require the ioctl cmd and arg to be passed to dm's prepare_ioctl() method. Signed-off-by: Martin Wilck Reviewed-by: Hannes Reinecke Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin --- drivers/md/dm-mpath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 8b7328666eaaf..7c60aace8d25d 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c @@ -1815,7 +1815,7 @@ static int multipath_prepare_ioctl(struct dm_target *ti, int r; current_pgpath = READ_ONCE(m->current_pgpath); - if (!current_pgpath) + if (!current_pgpath || !test_bit(MPATHF_QUEUE_IO, &m->flags)) current_pgpath = choose_pgpath(m, 0); if (current_pgpath) { -- 2.25.1