Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp3141459pxb; Tue, 24 Aug 2021 16:33:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRRSsi+r5QVrDv2/tvIBOTC16Jn7kG3z+dav3jqtFOMk/5D3UUe2Ovr/TNmmbR+IzE82E9 X-Received: by 2002:a50:e699:: with SMTP id z25mr9082791edm.130.1629847995463; Tue, 24 Aug 2021 16:33:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629847995; cv=none; d=google.com; s=arc-20160816; b=QwOBoYnXtLR5feCEXjARa/fow8NPnVCsciq1/xmSoWcnFc4Dxi8KiStbdOgfbF+GGX W4K8Oh1zH4sYpO1RMSfXqSqMxfO8A9R/jBXKtkt9W/pvToJLJD6voE5Ds+PVMGQzm4Jb hYVy7zXv59HckFP60Hl9AFsQKjhsFAkuTbAql2MGc67pTeE6UCgOswlsh4kILiUJpvs1 FajFYP9TMiOsuCp4EGduaGt+ZxkGrj5DdtF9uxxmHzVa6T0B6w6RA1e9MgUmZIcsMlKv iAtzI2H1WqUCHUgw2KRKnNhGZ2SIjurzpH0FQ72vHkYLGtKzA6daExttRBuFS4V3JD39 e3Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=NTPDB7m7dyZLnD3UIQrubsmhnyaUeTixwUjS6lNG68w=; b=QMqcuE+SbCytY4NJYe7/FeYKGfWqI1YVxUMR2hL9phL0RzlDhW/qDww3AiNN1vUnDJ eWzcOVdzh2nVeoYPs2KaXZqwBUApFk++ugD9gKTLZzVJS34Xo5931Eohma8rKQZ6nzVp WmBB4ABpRSDyjMQQLEtPm0UfJGte1DGQuu3FDlJKHfgITQo9hOtud6mM2lzM95Ig47ta oYh0IzNem8u1lWykhCCNwUIX0z96fLjHlA54HcAt/sMk7F2ic+A4Ew2VS7qU3vrX0Bw4 KNMXmWydH15xJ/Vit6xmiSdJkRHX8PrSoFgIHRul2Baug609lLXJVYKInoWNH80lI4kP c89g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PrCA9PxH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eb13si4001983edb.420.2021.08.24.16.32.35; Tue, 24 Aug 2021 16:33:15 -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.org header.s=k20201202 header.b=PrCA9PxH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234662AbhHXXbJ (ORCPT + 99 others); Tue, 24 Aug 2021 19:31:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:55100 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231552AbhHXXbJ (ORCPT ); Tue, 24 Aug 2021 19:31:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EAF9F610F8; Tue, 24 Aug 2021 23:30:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629847824; bh=aBZ/uH2vbAthAfmTJZ4TTBiPAcZ3NPXOPH71fmoGF0s=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=PrCA9PxHtwM75+FX3ElELCMEJrgZcZW+2ql/v8rBabw4KvT/cn0jJ6BUU6W0EA96H c/qIeJQQs5xS/rER4jK0ThdFWHwxQiPfgvwHKDZAZSJDABAdjrkHB+83HRZE3m1DfS its2b9N4AnXxPxKBU6sMneI8oYLhf74Edd2YmszS/vIuNOpIg5uEcUZPk3pDaa1xnl N7p19VsGKh6qO64HoSXQfw8BxBNrx7P85uRbrnlAodpio54t4mZ9yfzb+JTqIbwz/x TtEBNWS6eZVD0SiTtXr1x1NipzYwsFw746RqloXZH6e0+t//Ug1vbI5wiWhbSO0Fmc pfGe9LOFzm+mg== Subject: Re: [f2fs-dev] [PATCH] f2fs: don't ignore writing pages on fsync during checkpoint=disable To: Jaegeuk Kim Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net References: <20210823170151.1434772-1-jaegeuk@kernel.org> From: Chao Yu Message-ID: Date: Wed, 25 Aug 2021 07:30:22 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/8/25 1:09, Jaegeuk Kim wrote: > On 08/24, Chao Yu wrote: >> On 2021/8/24 1:01, Jaegeuk Kim wrote: >>> We must flush dirty pages when calling fsync() during checkpoint=disable. >>> Returning zero makes inode being clear, which fails to flush them when >>> enabling checkpoint back even by sync_inodes_sb(). >> >> Without this patch, file can be persisted via checkpoint=enable as well, my >> testcase: >> >> - mount -t f2fs -o checkpoint=disable,checkpoint_nomerge /dev/pmem0 /mnt/f2fs/ >> - cp file /mnt/f2fs/ >> - xfs_io /mnt/f2fs/file -c "fdatasync" >> - mount -o remount,checkpoint=enable /dev/pmem0 /mnt/f2fs/ >> - umount /mnt/f2fs >> - mount /dev/pmem0 /mnt/f2fs >> - md5sum file /mnt/f2fs/file >> chksum values are the same. >> >> Am I missing something? > > I'm trying to address one subtle issue where a file has only NEW_ADDR by the Oh, I doubt that we may failed to flush data of all inodes due to failures during sync_inodes_sb(), additionally, how about adding retry logic for sync_inodes_sb() if there is still any F2FS_DIRTY_DATA reference counts in f2fs_enable_checkpoint() to mitigate this issue, e.g.: f2fs_enable_checkpoint() do { sync_inode_sb(); congestion_wait(); cond_resched(); } while (get_pages(sbi, F2FS_DIRTY_DATA) && retry_count--) if (get_pages(sbi, F2FS_DIRTY_DATA)) f2fs_warm(""); Thanks, > checkpoint=disable test. I don't think this hurts anything but can see > some mitigation of the issue. > >> >> Thanks,