Received: by 10.223.185.116 with SMTP id b49csp2213586wrg; Thu, 15 Feb 2018 08:12:07 -0800 (PST) X-Google-Smtp-Source: AH8x227MsZyMLgEGdHRkVJwAUTl7w1cTLbCUUmadgucNvHOPun+S0IK/o5jPOU+7M6SBFuA4rRKu X-Received: by 2002:a17:902:bcc7:: with SMTP id o7-v6mr3070472pls.218.1518711127270; Thu, 15 Feb 2018 08:12:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518711127; cv=none; d=google.com; s=arc-20160816; b=RktWG/w2qTnP+Qg2TgQ0jTvKIm6RrGM0m5mltcXJZOhoXWG83Wj7Sfj1yNOQxw54xN /NFnKBZ+XeSRBYPZuLFQ7atzFjskPd9ZazNBdht2x0F0EizlL5HfphYFiUYRdHCbjAzH htVZkwQ0eeQVNR9rEAqbyTPTdjlQ4t7QQy5jnH/TCTduFdzVOssLnZuukRfsG/XThrlD 9eEBOh6M/O3QtiSB2+saBDeydRm2vOX4S2ozcNNqP8vo/VJzjVQDG+mupdxdfsb3hjre cEk4iZT6PiUzA0aQ6WZPSfH2SVJLIetmVN5tstFinnJ3DoE8OiCGxPwq3IdCoZGkyhmv ox7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=tD+uVOejeHY8yVUeROfRx1ObQLwBvzRsIIycHiCbDLM=; b=iJFSK1k5zJBSLZlXjJlA0BxrnTWfNxDS60wJsyKxW/dFN25Wn5opBSk8dbPKkYSL4j EyeKVpGak4o8eHq9+y+SNB8n123i1PC4QCCN7pdAjVuEJ61cTGjWeRe/HqqGBN2zQb72 j44OTfOxxvVI4BU6dZ9c2NBij9/BH6zEDerCKnO3RGR3EjvLuHCI6k3r/9c7/Jdxes14 ZgP3qx73CkIbBG3L+R74H/LAkGNUnkXsRb/lrV/4xQcIhjM4dQ7wtySCemYFtIZu6BbP +LV408X7QOCZ0+jBxi7+9tIxj46cjm+RAki6fBa+3ll0ni1Id9jaHVFDOBLEp/wpnBSl W3uw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a18si1015206pgn.669.2018.02.15.08.11.52; Thu, 15 Feb 2018 08:12:07 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424469AbeBOPpY (ORCPT + 99 others); Thu, 15 Feb 2018 10:45:24 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:34906 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424457AbeBOPpV (ORCPT ); Thu, 15 Feb 2018 10:45:21 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 482BF11C2; Thu, 15 Feb 2018 15:45:20 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liu Bo , David Sterba Subject: [PATCH 4.15 147/202] Btrfs: raid56: iterate raid56 internal bio with bio_for_each_segment_all Date: Thu, 15 Feb 2018 16:17:27 +0100 Message-Id: <20180215151720.708394341@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151712.768794354@linuxfoundation.org> References: <20180215151712.768794354@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Liu Bo commit 0198e5b707cfeb5defbd1b71b1ec6e71580d7db9 upstream. Bio iterated by set_bio_pages_uptodate() is raid56 internal one, so it will never be a BIO_CLONED bio, and since this is called by end_io functions, bio->bi_iter.bi_size is zero, we mustn't use bio_for_each_segment() as that is a no-op if bi_size is zero. Fixes: 6592e58c6b68e61f003a01ba29a3716e7e2e9484 ("Btrfs: fix write corruption due to bio cloning on raid5/6") Signed-off-by: Liu Bo Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/raid56.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c @@ -1435,14 +1435,13 @@ static int fail_bio_stripe(struct btrfs_ */ static void set_bio_pages_uptodate(struct bio *bio) { - struct bio_vec bvec; - struct bvec_iter iter; + struct bio_vec *bvec; + int i; - if (bio_flagged(bio, BIO_CLONED)) - bio->bi_iter = btrfs_io_bio(bio)->iter; + ASSERT(!bio_flagged(bio, BIO_CLONED)); - bio_for_each_segment(bvec, bio, iter) - SetPageUptodate(bvec.bv_page); + bio_for_each_segment_all(bvec, bio, i) + SetPageUptodate(bvec->bv_page); } /*