From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941577AbcKQRVa (ORCPT ); Thu, 17 Nov 2016 12:21:30 -0500 Received: from szxga01-in.huawei.com ([58.251.152.64]:62966 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935045AbcKQRT7 (ORCPT ); Thu, 17 Nov 2016 12:19:59 -0500 Subject: Re: [PATCH] f2fs: fix fdatasync To: Jaegeuk Kim References: <20161116121211.11790-1-yuchao0@huawei.com> <20161116191312.GA57609@jaegeuk> <25a9f225-ba22-d0cd-54ff-4a75031bb161@huawei.com> <20161117025911.GA67852@jaegeuk> <3407da1c-ee9c-3a8d-de26-cebd18a79057@huawei.com> <20161117034138.GA69766@jaegeuk> CC: , , From: Chao Yu Message-ID: Date: Thu, 17 Nov 2016 20:12:25 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <20161117034138.GA69766@jaegeuk> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.134.22.195] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016/11/17 11:41, Jaegeuk Kim wrote: > On Thu, Nov 17, 2016 at 11:35:58AM +0800, Chao Yu wrote: >> On 2016/11/17 10:59, Jaegeuk Kim wrote: >>> On Thu, Nov 17, 2016 at 10:51:37AM +0800, Chao Yu wrote: >>>> Hi Jaegeuk, >>>> >>>> On 2016/11/17 3:13, Jaegeuk Kim wrote: >>>>> Hi Chao, >>>>> >>>>> On Wed, Nov 16, 2016 at 08:12:11PM +0800, Chao Yu wrote: >>>>>> For below two cases, we can't guarantee data consistence: >>>>>> >>>>>> a) >>>>>> 1. xfs_io "pwrite 0 4195328" "fsync" >>>>>> 2. xfs_io "pwrite 4195328 1024" "fdatasync" >>>>>> 3. godown >>>>>> 4. umount & mount >>>>>> --> isize we updated before fdatasync won't be recovered >>>>>> >>>>>> b) >>>>>> 1. xfs_io "pwrite -S 0xcc 0 4202496" "fsync" >>>>>> 2. xfs_io "fpunch 4194304 4096" "fdatasync" >>>>>> 3. godown >>>>>> 4. umount & mount >>>>>> --> dnode we punched before fdatasync won't be recovered >>>>>> >>>>>> The reason is that normally fdatasync won't be aware of modification >>>>>> of metadata in file, e.g. isize changing, dnode updating, so in ->fsync >>>>>> we will skip flushing node pages for above cases, result in making >>>>>> fdatasynced file being lost during recovery. >>>>>> >>>>>> Introduce FDATASYNC_INO global ino cache for tracking node changing, >>>>>> later fdatasync choose to flush nodes depend on ino cache state. >>>>> >>>>> We don't need to add this additionally, and would be better to consider other >>>>> major metadata as well. >>>>> >>>>> How about this? >>>> >>>> Seems it can't track file after evict? >>> >>> Do we need that? That means inode page was already up-to-date? >> >> I mean if node/data page of inode were writeback by kworker, after evict, if >> user open it again and call fdatasync, after sudden power-off, we will not >> recover it. > > That will be handled by need_inode_block_update() below? Confirmed, let me send v2 and do more tests. Thanks, > > Thanks, > > . >