Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1962113ybl; Thu, 29 Aug 2019 01:19:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqxoGASGwq3m84ny8rLNhFncBJvK5MJmT90mw2+apr49scPKgtcVjj/DXUe552PuhF5CZpE/ X-Received: by 2002:a17:90a:8a0d:: with SMTP id w13mr8249227pjn.137.1567066750608; Thu, 29 Aug 2019 01:19:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567066750; cv=none; d=google.com; s=arc-20160816; b=YUDsy4OAC++A9P8OKVEGhfqs/lXbeQsEEvxkw4YipDtsHT+oLoMZyJxGJb4aprHEjJ /GmRmUqYUNL7XZ1bn5x4aHRRkIiqxx2liX4cd2zL/z4Zj9Bq7qiQ49xRfCRN2UD6Km2S wRX4K0XeGPCOD2PEWDH+h+zkWbRs9ZN1klLrTHAovj8h6FfOGmHVBCGC4D0IOPLOeeXj hLXVC928JqkwEEuEkN8heXjhUqu9NgYT8KUoa2xZAVdwqEdvh048NVdc9vpS0CbGjd6K +P9YgJK6xozeu6r5M4jgqFO6saLCowH0lNY7OlqFE9hI7Hd+/D89f9QPY2TBN5Mp/hru jjcg== 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; bh=QI2hxgl1P6zyJZkffgIGdqpQFqeewsTYRXlF5w2IvdI=; b=im4CSIHDV8OKi/AbX3F7CXz48jVrtv2sZAKfj+m+28S7XTo9/C6DM4NbSJSR/Wzs5h 5UDUI0uLzuXKka69gbJyAqmtqYOJ8M+I1f99apt8X/yLb4Yj4EDwkrcqubTU/ARQhRQn befXtVBr44HGowcqfD7voyU+i+Z8+4scTHrK+tKGbEcMEqT97w/LODZL+Uhy7TqqaL1S nyHmHsc8AwpRXXRCXjovnh/0f/n2HwMKOtu+pwdkGxrhK+aQNdAXqUlVTQzXWEgcmk7o Pgp3PmvClrZJz7VFjyLZfv6Qu5y2+BivAa0PhN+AGYfS4sc2n0+g5po1QbPRUpLtlI3U R9Sg== ARC-Authentication-Results: i=1; mx.google.com; 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 v20si1758365pfn.133.2019.08.29.01.18.51; Thu, 29 Aug 2019 01:19:10 -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; 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 S1727040AbfH2ISd (ORCPT + 99 others); Thu, 29 Aug 2019 04:18:33 -0400 Received: from mx2.suse.de ([195.135.220.15]:59050 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725782AbfH2ISd (ORCPT ); Thu, 29 Aug 2019 04:18:33 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id B24FDAD23; Thu, 29 Aug 2019 08:18:31 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 4709D1E3BE6; Thu, 29 Aug 2019 10:18:31 +0200 (CEST) Date: Thu, 29 Aug 2019 10:18:31 +0200 From: Jan Kara To: Matthew Bobrowski Cc: Jan Kara , linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, tytso@mit.edu, riteshh@linux.ibm.com Subject: Re: [PATCH 2/5] ext4: move inode extension/truncate code out from ext4_iomap_end() Message-ID: <20190829081831.GB19156@quack2.suse.cz> References: <774754e9b2afc541df619921f7743d98c5c6a358.1565609891.git.mbobrowski@mbobrowski.org> <20190828195914.GF22343@quack2.suse.cz> <20190828215421.GA9221@athena.bobrowski.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190828215421.GA9221@athena.bobrowski.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu 29-08-19 07:54:21, Matthew Bobrowski wrote: > On Wed, Aug 28, 2019 at 09:59:14PM +0200, Jan Kara wrote: > > > @@ -257,6 +308,13 @@ ext4_dax_write_iter(struct kiocb *iocb, struct iov_iter *from) > > > goto out; > > > > > > ret = dax_iomap_rw(iocb, from, &ext4_iomap_ops); > > > + > > > + if (ret > 0 && iocb->ki_pos > i_size_read(inode)) { > > > + err = ext4_handle_inode_extension(inode, iocb->ki_pos, > > > + iov_iter_count(from)); > > > + if (err) > > > + ret = err; > > > + } > > I noticed that within ext4_dax_write_iter() we're not accommodating > for error cases. Subsequently, there's no clean up code that goes with > that. So, for example, in the case where we've added the inode onto > the orphan list as a result of an extension and we bump into any error > i.e. -ENOSPC, we'll be left with inconsistencies. Perhaps it might be > worthwhile to introduce a helper here > i.e. ext4_dax_handle_failed_write(), which would be the path taken to > perform any necessary clean up routines in the case of a failed write? > I think it'd be better to have this rather than polluting > ext4_dax_write_iter(). What do you think? Esentially you'll need the same error-handling code as you have in ext4_dio_write_end_io(). So probably just factor that out into a common helper like ext4_handle_failed_inode_extension() and call it from ext4_dio_write_end_io() and ext4_dax_write_iter(). Honza -- Jan Kara SUSE Labs, CR