Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5115829ybe; Tue, 17 Sep 2019 02:55:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqwimB7M+nmrfaR+lpYtlfR45qckS04wni4DFe+BWSyBSl3TenFuQW3HmO+/qBhuOVZWGXwv X-Received: by 2002:aa7:d694:: with SMTP id d20mr3618017edr.226.1568714113969; Tue, 17 Sep 2019 02:55:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568714113; cv=none; d=google.com; s=arc-20160816; b=meeMcWnuT/t6Yq5pirLGxtiqTVEgvaNZYNMgFq05IOMK3RBGIlWl1dw3tC3vowUTx+ XUhtmfQ90ALhy5oYxFPn1Umyy0p7X47a1SjYRIa6L8wATIyWJnk1rKU94IgLXYrn8mi+ kErnv8KDmTmM3b1CJzrkEKFzaRvzC5v7/0cd6yqaRRF2YMajQNDaPmB44GncDUez8UKS xgHFItvbvd9G8oJxqWsbHOfsvji3Ik1QPQ/826M4psMveuwrNdgHk2d59ntN+IbjxUn/ hQRN2wG53osIO5il0wbESV4WFiKkJe685M3fZgx/5opJZ8goP1QaQCt6W3HQO0PuP+dc KA7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=iqBZEA4YTCWclU3x+SYwFnPkWSOVdw1g4J1I3clqTLE=; b=qWMonxWUFMln/BZLIAgV5zLY2D+1vC/kpCOiCHmG91VhpZcFgZ6LwB0eY2koNGmw97 VWDad0VmQ/K+mtUqq1+XcwCQA6yX36801tOiAtdsIATTCaMwJG5Vgq1s8BUw4WamVMR9 EPk4M0iGLFJ/P5jpfGQTvKO+XEs4K4Y/x/e7l1e3TX7SQiszEUp70pQd12/K7qfmdvis C+tceGKDNfpXfrORDPJCKBnP0fd4hlV8ZJm4sEVHz9g/0Jv1kH33dgwemC0U9GhN4PL/ 8l6uavp5PK6r8s4qH2e27Gv9AWW5zwGjX/TaoFfh2c+8RYh7+Wydi5v0hgbeMW1YN6T2 6qUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=aVrQFxVb; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-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 a8si1139600edm.240.2019.09.17.02.54.49; Tue, 17 Sep 2019 02:55:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=aVrQFxVb; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726285AbfIQJCk (ORCPT + 99 others); Tue, 17 Sep 2019 05:02:40 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:42316 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726271AbfIQJCk (ORCPT ); Tue, 17 Sep 2019 05:02:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=iqBZEA4YTCWclU3x+SYwFnPkWSOVdw1g4J1I3clqTLE=; b=aVrQFxVba+3Rx3+yG7OtGYsdZ n1kze3ps11lG523KPTva5+UDPD/dNFluJsIEavLSEYgmpF0jdbM+/MGI3d6mnZPempVk5AbrbA9Ml SHYI6dcEbW16ABJaS2do1FyEhvBan5UNzLy1RCrcIaKQe62HUyUDEJGsIimHy/eVr115DEfCCrl7W zGzOC3XMcQoDhCkOXchau7UY8Bsv5DNmYsQlZBWFkRLybCY5E1HEwnD2s1eSusQLPXVZZ2IH4ChZq j9NGlDVRR8XECwUDBJo4CuQOZWI7DqtRbE64xAOPFGkhuyGcThX7mRAnaQAasPzHISOY2dK877F8M mhVBk4h8w==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.2 #3 (Red Hat Linux)) id 1iA9NZ-0000mW-NH; Tue, 17 Sep 2019 09:02:33 +0000 Date: Tue, 17 Sep 2019 02:02:33 -0700 From: Christoph Hellwig To: Ritesh Harjani Cc: Matthew Bobrowski , Christoph Hellwig , tytso@mit.edu, jack@suse.cz, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, david@fromorbit.com, darrick.wong@oracle.com Subject: Re: [PATCH v3 5/6] ext4: introduce direct IO write path using iomap infrastructure Message-ID: <20190917090233.GB29487@infradead.org> References: <20190916121248.GD4005@infradead.org> <20190916223741.GA5936@bobrowski> <20190917090016.266CB520A1@d06av21.portsmouth.uk.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190917090016.266CB520A1@d06av21.portsmouth.uk.ibm.com> User-Agent: Mutt/1.12.1 (2019-06-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue, Sep 17, 2019 at 02:30:15PM +0530, Ritesh Harjani wrote: > So if we have a delayed buffered write to a file, > in that case we first only update inode->i_size and update > i_disksize at writeback time > (i.e. during block allocation). > In that case when we call for ext4_dio_write_iter > since offset + len > i_disksize, we call for ext4_update_i_disksize(). > > Now if writeback for some reason failed. And the system crashes, during the > DIO writes, after the blocks are allocated. Then during reboot we may have > an inconsistent inode, since we did not add the inode into the > orphan list before we updated the inode->i_disksize. And journal replay > may not succeed. > > 1. Can above actually happen? I am still not able to figure out the > race/inconsistency completely. > 2. Can you please help explain under what other cases > it was necessary to call ext4_update_i_disksize() in DIO write paths? > 3. When will i_disksize be out-of-sync with i_size during DIO writes? None of the above seems new in this patchset, does it? That being said I found the early size update odd. XFS updates the on-disk size only at I/O completion time to deal with various races including the potential exposure of stale data.