Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp982267ybt; Wed, 17 Jun 2020 19:52:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMTOJLR91UpTstcrqu7KodPJhglFEljg96uzZGNa3vCfc3TORzwaz3OcLVqPBLxKJ5Ru1W X-Received: by 2002:a17:906:ecfa:: with SMTP id qt26mr1996538ejb.493.1592448751969; Wed, 17 Jun 2020 19:52:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592448751; cv=none; d=google.com; s=arc-20160816; b=PBw1fIJzjsMQQthUiC2CES88KIqQJgWSXCbCcjxr4T4bo/O0XxAhabJ0Zw9kjhWPWg UvA2pNev9Bwp9jeWD2EWOvxXer1YZ1uDuYdGAHGL9rU9hfoLP1bgz/N0nVmaj7mPFwfT GMFBn9U44wSwAoVFswaEZf8w+x+W5Ij4qeffqb6431RpM0/hvt5s52XyJfZzf0ngtTet 2WLDW2Z9ZSHepfxo4mx23NTHx/11Yv0w7AWPliufFfQH0ae/674wgBEiXK/EbrTenyYd wYDT0LnFiYNrK4y6z4Sl9m3OLSINjAaVVsqPGgbDfuWIV8T1E5D/PVYOZAFnlxGHvmiy 53ZQ== 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=SyNJKxdOf7G645ptmGPsZm0d+Qk0AcEkCLGjWP+1yYQ=; b=CHHAQR+nLnnGDOZ5FGjOSQ8yOMA3lT7VPlI3adTh4pPLk3FMgP16KajEkuMiM/whvC 7dYO+8qBMWxssfPHE4ie6nv33sau4ofSvDm1C8pI87E3/sVA16Q/8FYVEGmCGxHoX5zv C8p5I9lEE4ebQFQGc3PvDaCAuOAYSTBHlKAmBvC60afe6e6V73DAautW+Fed9nN4HYP6 IJIGMSVeS/3HRRJfW9lf5nXajpKEwAVIpedLYuWWPo6NKAB5k+3B/BjIAZgYDtA1S5pV 1T8LydczqSoGmiVMagyCuojbejDB8Yy/zWxOdynvt4RHjW+jiN4EnFFsQrj8soNxArKC f7/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Futf6twz; 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 d2si976898ejw.702.2020.06.17.19.52.09; Wed, 17 Jun 2020 19:52:31 -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=Futf6twz; 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 S1728096AbgFRBJP (ORCPT + 99 others); Wed, 17 Jun 2020 21:09:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:35264 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728049AbgFRBJJ (ORCPT ); Wed, 17 Jun 2020 21:09:09 -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 3D3F521D79; Thu, 18 Jun 2020 01:09:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592442549; bh=aQ+s8ER3hoBSa3ufxybtu7BNUAdGWVj2UOglNEeqrkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Futf6twzzErxSNRzzl8puiYgpoZ0a3K2UBu7t8gjG6VHtOexbil5+Wj3YhBGwOdCV jwy84lLPURfYlcd+8C15GyUBZi9+v1vcx+ZcG0gvuHTSPlWxhF+0tQrammOSSgGblb tKlh8bL8MiC/8CMzHNAQS1NFGwIQcxDrklCVgtRI= 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.7 047/388] dm mpath: switch paths in dm_blk_ioctl() code path Date: Wed, 17 Jun 2020 21:02:24 -0400 Message-Id: <20200618010805.600873-47-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200618010805.600873-1-sashal@kernel.org> References: <20200618010805.600873-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 3e500098132f..e0c800cf87a9 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c @@ -1918,7 +1918,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