Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp206580imj; Thu, 14 Feb 2019 18:41:13 -0800 (PST) X-Google-Smtp-Source: AHgI3IZSCi1WsyFSDlUzY/pf4uYSyG6FrG3LW1rICfy8kVPGKrpj2414zaTZGL5omThWLcTDLGm9 X-Received: by 2002:a17:902:a513:: with SMTP id s19mr7538329plq.324.1550198473617; Thu, 14 Feb 2019 18:41:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550198473; cv=none; d=google.com; s=arc-20160816; b=VklhOYXL6Q1AI3JI2wz12i+AHehhzpPrNtQtUajDXNGayn6D0rkQbYneK7pakWe1pX MhKrK1j3Cf9NyhjbXtd5s/Ek8lNBZsOJ9or1ZWh1ca7RyACOqzPEoM1W2hrjwWAjduXF MUKVXx2d/KkmC8YGQuB5OBkyw4Qu4bVrm+Hk0G6AMx360TVIkDFyoMO61DWJUxYid3Oh H3M7vC9gWuFRN5sP02YB81L5DKOvad4QfYh4TxSWbgWQii6Wy3uEVITz5xSdLucQGsFP Jz+jOj+ZCN+YAIIsg0YpmtkpwdwgreUQjyf7PdW/9p+a62c7LdXJlYlJ/pQl0wAx4ifk fqkA== 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=VChhAx55/pzXFKePvPPCEKfe5QDXOT1ZQJA81o47BZU=; b=v3r6LjeV0tuUZYTVOctl1trY/KAcEx8G1Rrdw4bZJ/smILMR3gBgH09+PhNF5rAu1D cQSTI1Kg9hWCAK1sA/YBF1xeW7I/BOfSUKdSpA4XOswprYue/2LCae0U4q+4b3qQ761a OLjJjfH7R1/mOIsAARtu0ZXI/oO2Myz8IjgRBw7X0rz4JrFGH0h4D69MxdmqFJOl4x+a Iv5ta/ppwkOn5RSeZck2uJnBL3JNtCs8L6rYaMEa0m30m+XOzFBZIrylzXIQxvn2RDcg ScntUFcIYqT6UQ/WKgArIXogQIJmqD8xCPjhJ0c7Nd0X5BoKiqwKpmJezfv1PxzgjWRy 0uTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LqzQssBx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id b38si4346035plb.11.2019.02.14.18.40.57; Thu, 14 Feb 2019 18:41:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LqzQssBx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1729970AbfBOCjs (ORCPT + 99 others); Thu, 14 Feb 2019 21:39:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:50284 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390082AbfBOCKI (ORCPT ); Thu, 14 Feb 2019 21:10:08 -0500 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 5F8F5222D4; Fri, 15 Feb 2019 02:10:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550196607; bh=RQbOA/2qXbXRj/PnuDPXS1pwUexYP1IRfzbwEV7TUHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LqzQssBx8ipHGGSL4fRFUrC/zWA00+Kne3aJ9/J1SvYtS/B3qcv3kijxRdSzQGzva XFjY+P86HfTj6132NvtxkaAxGGaIJeCsoIf/2pQ+LZt2+yMHgqDNyeiFYdRldztlP0 Z6GwX+89wcyU/WlUeqUzeickQ2MlrZpBtroq54pQ= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mike Snitzer , Sasha Levin Subject: [PATCH AUTOSEL 4.20 42/77] dm: fix clone_bio() to trigger blk_recount_segments() Date: Thu, 14 Feb 2019 21:08:20 -0500 Message-Id: <20190215020855.176727-42-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190215020855.176727-1-sashal@kernel.org> References: <20190215020855.176727-1-sashal@kernel.org> MIME-Version: 1.0 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: Mike Snitzer [ Upstream commit 57c36519e4b949f89381053f7283f5d605595b42 ] DM's clone_bio() now benefits from using bio_trim() by fixing the fact that clone_bio() wasn't clearing BIO_SEG_VALID like bio_trim() does; which triggers blk_recount_segments() via bio_phys_segments(). Reviewed-by: Ming Lei Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin --- drivers/md/dm.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 63a7c416b224..7138e69d40e0 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1318,7 +1318,7 @@ static int clone_bio(struct dm_target_io *tio, struct bio *bio, __bio_clone_fast(clone, bio); - if (unlikely(bio_integrity(bio) != NULL)) { + if (bio_integrity(bio)) { int r; if (unlikely(!dm_target_has_integrity(tio->ti->type) && @@ -1334,11 +1334,7 @@ static int clone_bio(struct dm_target_io *tio, struct bio *bio, return r; } - bio_advance(clone, to_bytes(sector - clone->bi_iter.bi_sector)); - clone->bi_iter.bi_size = to_bytes(len); - - if (unlikely(bio_integrity(bio) != NULL)) - bio_integrity_trim(clone); + bio_trim(clone, sector - clone->bi_iter.bi_sector, len); return 0; } -- 2.19.1