Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp14908pxa; Thu, 20 Aug 2020 23:08:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUhA7BR+EywG/DfiFs7+G+Oi58nHIrZwZDMpOBxTBWCiI3MOTYVnk1BohxLRdfPEerqYqE X-Received: by 2002:a17:906:4e57:: with SMTP id g23mr1366233ejw.92.1597990096358; Thu, 20 Aug 2020 23:08:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597990096; cv=none; d=google.com; s=arc-20160816; b=JT46QmiAtRcCtN7b0lMYuZV3aVTX+ZOGUSHaNH/xJM2K0IzAz1A4i3wsOI5+LhFaEt zLJD7O1dlYPq2IcTTLPup1iLF6rZKPo9TfOjP/fhwMHOGR42JWt/s+GSUcav7R82ScN8 cyXE+2xDkD1oFG/YAnybUPLBwcBLeilAf6XJ+5kr3ZFeFf+O8yDmCEBBvHFoezZe1j/V DsCwesqiBXn8ClTDb8ZVWHqiVpWVJ7Ihz8qxahdg+1M/iIGJuOhg1iEBrBvp7Wr2x3+3 cz7+abH7XZKTZl84lQDRrLpnZJtkGL+HafwpzEu9I0GQRrdQ5ofKt17D7EFrmRLlJW37 JO6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=csBfSNWoqycX+qwrSd8VYEM/dpU2DB6oNeP8NG+28Xc=; b=Jpm98BCOIa08JTNpDMyh01IZwrvYWkIHuqVKeg3UlbtEq9Kf/QVorBOotY9IWJ/yo6 ujmQGVOVY38pDSnDg8npRwozASO6GXNik15UwPurC+SL2L0jmcZIUon3d1Ial3+ydWRa Ruoq8fQ4Tu8LB60HziP8GabKIAJMqhtDNFSjSI/rveNPRnbDTJDEHcIQEmBL3WGhc9Qp +c1IkMVoB19bWFTWd9ArF79P0igA2xrCoV22Xh9eSrfN5BOhqLU3m77jjAOBPB2wA0+l hkrMaEiO9OOoKFqZlLk5e/TLZzF7Y5dtj3jyZMRKlXwSESnoAGnti/askNni68rMpqup pYSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=qTzxO5uk; 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 j1si493130ejt.542.2020.08.20.23.07.52; Thu, 20 Aug 2020 23:08:16 -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=fail header.i=@infradead.org header.s=casper.20170209 header.b=qTzxO5uk; 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 S1727772AbgHUGHS (ORCPT + 99 others); Fri, 21 Aug 2020 02:07:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725268AbgHUGHR (ORCPT ); Fri, 21 Aug 2020 02:07:17 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5694C061385; Thu, 20 Aug 2020 23:07:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=csBfSNWoqycX+qwrSd8VYEM/dpU2DB6oNeP8NG+28Xc=; b=qTzxO5ukJYkNNSGikvE5RnQCsQ +KhwGfIq6hKk3uBbnfLAgUR6FOhqgOt59pJRlc0mbEP8P4TjhIuEZGm4ZoWQ5tHFIPDTLxVx3sE7F 7xfpj0y+M3F4xbaUxu+WQAk/K7vicbV335ik6f4aVmA5z0XxD5zPq3ld4vSv42DrYWQMkfC7lXOEC 69UtcSsu2hfM4jhvRLl5r/P8l8UgaIOV0jsqM9XRd7i9P//Oowm/NKHFN800e6HDD2igBVHRvF79f 8hsaUc3M6hvOlT4S5EGBd2yDs1FLYAilAgstS28qEoeSxvHfcH49rBEXEKfH2ZwQSLRl2YgW+zm76 BaSKRdoA==; Received: from hch by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1k90Cl-0000M6-0v; Fri, 21 Aug 2020 06:07:11 +0000 Date: Fri, 21 Aug 2020 07:07:10 +0100 From: Christoph Hellwig To: Anju T Sudhakar Cc: hch@infradead.org, darrick.wong@oracle.com, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, willy@infradead.org, riteshh@linux.ibm.com, linux-block@vger.kernel.org Subject: Re: [PATCH] iomap: Fix the write_count in iomap_add_to_ioend(). Message-ID: <20200821060710.GC31091@infradead.org> References: <20200819102841.481461-1-anju@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200819102841.481461-1-anju@linux.vnet.ibm.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 19, 2020 at 03:58:41PM +0530, Anju T Sudhakar wrote: > From: Ritesh Harjani > > __bio_try_merge_page() may return same_page = 1 and merged = 0. > This could happen when bio->bi_iter.bi_size + len > UINT_MAX. > Handle this case in iomap_add_to_ioend() by incrementing write_count. > This scenario mostly happens where we have too much dirty data accumulated. > > w/o the patch we hit below kernel warning, I think this is better fixed in the block layer rather than working around the problem in the callers. Something like this: diff --git a/block/bio.c b/block/bio.c index c63ba04bd62967..ef321cd1072e4e 100644 --- a/block/bio.c +++ b/block/bio.c @@ -879,8 +879,10 @@ bool __bio_try_merge_page(struct bio *bio, struct page *page, struct bio_vec *bv = &bio->bi_io_vec[bio->bi_vcnt - 1]; if (page_is_mergeable(bv, page, len, off, same_page)) { - if (bio->bi_iter.bi_size > UINT_MAX - len) + if (bio->bi_iter.bi_size > UINT_MAX - len) { + *same_page = false; return false; + } bv->bv_len += len; bio->bi_iter.bi_size += len; return true;