From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 568CAC433DF for ; Thu, 18 Jun 2020 02:25:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2C1562192A for ; Thu, 18 Jun 2020 02:25:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592447145; bh=E26Z2uGMlLvZZQOaDHdserktZJN5eR2gHFfLP0ErK4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=S3xy3lGAR0F6x8o8lW/CPpu9NerI0qTMiH18p3xfSKDpHYy8OzNn8tdHIBQzsey4O Z0OJXi7KjvkBHK9x9XjBpIfUULGtUJKt+T5ozbr0gLp4IVJThujyGyhR3gOR5DhZR5 4nfWqQUWl55l/7e+9EGYbMcYC5X20bt2BCCDeSXg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730371AbgFRCZn (ORCPT ); Wed, 17 Jun 2020 22:25:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:48480 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728962AbgFRBRV (ORCPT ); Wed, 17 Jun 2020 21:17:21 -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 2ACDA21D80; Thu, 18 Jun 2020 01:17:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592443038; bh=E26Z2uGMlLvZZQOaDHdserktZJN5eR2gHFfLP0ErK4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zEc6XMqhw4Q4dZmVKey04RAxaAEDTc6sZhD3H9ZPxD8Io7kGYx2VlHjZc+8pyVHAU n+IXLn8iN9fokRROB/id0o35364E5I/H0pmk6kFYDcebft/Tfbh5MBK23vJbo9PPGk 8cUZ+CB+gjWPhntWOZVD76bz2jXN5Pio5RYt2/NA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Martin Wilck , Hannes Reinecke , Mike Snitzer , Sasha Levin , dm-devel@redhat.com Subject: [PATCH AUTOSEL 5.4 035/266] dm mpath: switch paths in dm_blk_ioctl() code path Date: Wed, 17 Jun 2020 21:12:40 -0400 Message-Id: <20200618011631.604574-35-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200618011631.604574-1-sashal@kernel.org> References: <20200618011631.604574-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: 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 456d790c918c..f2de4c73cc8f 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c @@ -1856,7 +1856,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