Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp310345pxa; Fri, 21 Aug 2020 07:53:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPAIn6UxVUGkw7WPtcvY7TRyDwpu1iF4EQtHeqgRna9KbDT5b4RsPaYujAGzN/5e8tO+h7 X-Received: by 2002:a05:6402:1a54:: with SMTP id bf20mr3213030edb.217.1598021585851; Fri, 21 Aug 2020 07:53:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598021585; cv=none; d=google.com; s=arc-20160816; b=OiZUHN1VeHpfkChYJbsH4A8/NKxrurnskbAWB1X0USNClMnqJZ3JbxDGPQGXKzilQR 2qCHJ2ChPGSMNmFFv0GW6n/72M1XwCxZwXPTGzpjdcdgSi+W9ysWYrsnCPVwju5vPr/I pFjzGN+AfGLyEFTQj0UF2n346gFDLZ/7FmtYTtNnKbnLzJYewPbVM6bDr8yQYCdgtaVI KdKQAtOs+Z/u3KlCp4JXangCyuiWETF2vMn6dIyzhvAZs0TL4z/b6He/YckZ1Kkvdzsg LZp3v2rTZTwaY8vCXNHxgavTiJS2eZLPjla++xfACA0Fn6tBkNu+WULgPIBoNTTjw0SL tE5Q== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=cxwNFKr8C4GxHwwirPDVBn5gDOlxq9kCMJ9FIhV/7GY=; b=L0dgqWhmesph8hyGrBKg2AlvFLPMewNzHdWTbcJDqfSWrVZaU9VZaQFASOXq667cHJ vvFbgdBQwIM5pk+Rq5U2rTtxp54ddc1x0RacC8jUAvLoAdjKsERwwYltyzxk7SGOeJDs mXu2DenHJJxb3fZhl24r+OfVMbbUzMJj+6nXULc4yFzGbjyEzQ9qNeIAljdf9WMdAL2m ZJtkLSVenjLsrUbsB0jvyLw6wQP0k1kjUuemwGDEbeBmkqkAXdPtTJ2kaE1i3MFvgyOl jtfbHM1NxPqUCwuoaFt5EQQ++8+hdNUKomIPquORRvQgoB8KieJ07jruTad5P/pjUUdY vx3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=Tnzci+Hs; 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 cy23si1416081edb.311.2020.08.21.07.52.40; Fri, 21 Aug 2020 07:53:05 -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-dk.20150623.gappssmtp.com header.s=20150623 header.b=Tnzci+Hs; 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 S1727074AbgHUOty (ORCPT + 99 others); Fri, 21 Aug 2020 10:49:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726176AbgHUOtu (ORCPT ); Fri, 21 Aug 2020 10:49:50 -0400 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A100C061574 for ; Fri, 21 Aug 2020 07:49:50 -0700 (PDT) Received: by mail-il1-x142.google.com with SMTP id k4so1585929ilr.12 for ; Fri, 21 Aug 2020 07:49:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=cxwNFKr8C4GxHwwirPDVBn5gDOlxq9kCMJ9FIhV/7GY=; b=Tnzci+Hswj7hMTc7vA1mGeQReoVIr0yEMvnV9YEI5ZNO8EHi/EbODtgB9IZ8O9e0r4 5331vH21P4cphP7O8x7DdidRe968kxztCR0wbRdQ90uXkHhFT2ZRndHIEd3zEwpOlUxf QZQ9oFO/A1IF8zu3FRLvxEqDaK6oW4Et07rabfta86yhpF5RHI90s1nuNQn1o6aGpgZV 6dfBuucnLTzNOK1OgSpfAA8AdxMGWMlPlaxsE5B9zKCqy6CSOjIU10aRS80g9IFdlWOM o76/Fvv/zvyzxhhP5bsQ97og1Fcl2CciSIwyYBzZvEg5saoRAbQ8DXZ/L4UxgVmzZQTm SvfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=cxwNFKr8C4GxHwwirPDVBn5gDOlxq9kCMJ9FIhV/7GY=; b=J0d+PyIn9iY87ziI+P3acupUBf0Wu7gp2/zCX+HhmeYIvMep9sp2DfVEZLQR4hPZYh 60bqBCSjx549BVuYiLYy7+rDYPn19rof4oNnv59A1SwV7BRoQdCab1D7wt0E4FY3a35y nKz7VpMRp0yIrG60lJIag1qAT0X5bC7Jmp7ODy9I1KVN9WSeuMaPegKE5rFLjR5uZwNJ JZNbKINz26mAAmI90aDja7mM626aeYMZRszjVugDL5TQFPtDxDv4zE7T5E16ib+O1HqY 5b+FP9eZEhJrVSA9MUFB+3VCJndhyjrXcDpMlGpCZXe4e/xGsX6k37vBcxeWEr8OAhor Eo0w== X-Gm-Message-State: AOAM532XFuD9hOUZSclhNIDfKvh2dhdQkxq0OS133rSj6lLUEXK2nH+y nQ/8FrOvdmTLi07/Fz7kt2oNlg== X-Received: by 2002:a92:660e:: with SMTP id a14mr2868783ilc.290.1598021389768; Fri, 21 Aug 2020 07:49:49 -0700 (PDT) Received: from [192.168.1.58] ([65.144.74.34]) by smtp.gmail.com with ESMTPSA id p20sm1331088iod.27.2020.08.21.07.49.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 21 Aug 2020 07:49:49 -0700 (PDT) Subject: Re: [PATCH] iomap: Fix the write_count in iomap_add_to_ioend(). To: Christoph Hellwig , Anju T Sudhakar Cc: 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 References: <20200819102841.481461-1-anju@linux.vnet.ibm.com> <20200821060710.GC31091@infradead.org> From: Jens Axboe Message-ID: <9bf274cb-15ec-f389-42b3-b8469402af3d@kernel.dk> Date: Fri, 21 Aug 2020 08:49:48 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200821060710.GC31091@infradead.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/21/20 12:07 AM, Christoph Hellwig wrote: > 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; > This looks good to me. -- Jens Axboe