Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1639628rbb; Mon, 26 Feb 2024 17:01:22 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW3EDr1pXAN+DL3WXgC+eeboRB3jv6s0sC0VTJfhuMpoFgy84Zo8OhUYoQM6WqPAJwcdvG9JELjiffXIL8HB/3e3H3GV3/1XmvzhIr38Q== X-Google-Smtp-Source: AGHT+IE8OS0Q22sOG3i6eGkjNJuB70qHu2RBInh30wn/Za6MpWM6Q1tMwCDsXYNa7S4VsAAVuYQq X-Received: by 2002:a17:903:2447:b0:1db:f811:66f7 with SMTP id l7-20020a170903244700b001dbf81166f7mr9653469pls.60.1708995682350; Mon, 26 Feb 2024 17:01:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708995682; cv=pass; d=google.com; s=arc-20160816; b=eyWs35EU1UuSZM1o28sv4pud9lKLuNQy3OEldW8ClWbq5Jd1ibNNxv7m1WIcJj3BPN /Xaqsj10xmegHMy77rudLsQzy6vxImzXQJn5BS56GkIvMTRPA8LgR0acaOAv0U06vNHX dLQHV9sM3131DiwVhtmRLYhc9XTPS+qY95f8xIylNXSt/O4V7x+tbdUdqKErZsUMah7V tf6gKBI7r9wfG4B5OPNHzUa2lWBD0kXiYQ7ybgsqcIeAzrSr2KgC+EMSEv8un0rOMopj nd5fsqQ3VmFzcUaiIilVv1/t8tyO63EKvwDyGPJF8o+/x5MfrceBGBSqduBe28wKvA0x yMww== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:to :from:date:dkim-signature; bh=UKxmywUNfsLZD40OSctqIXSWsaKyd6MY7VQPBYa8mmI=; fh=YrirFCflo0HC1j049mfXEQ1jukbakoASvSGieiclzfE=; b=oKCl4aOvYPVUJxtffgIm3BLSVSY5We6XRe4ACcsXjpnWTnK1IL3EBmKN1X31TYcMDi UhSlZngQ6ATvSeWlrpxEpUxDBbeCtBwcTn5ySkEEDIJaFgDtwYvWJOyTzWp95mMxXlIR RhZfYLa1NtvYoXCOyFzgpJF7nQCdeMZGglrE8Kp79/tGXqjVTmFSQLwHp+2DElEn84l+ k8YB41VuepebCEFRwXPFFJlZ8gtzU5LDt5t5SrdtnqHgrnctB/zmQ7FWdB0b6psQYC8o Qs6+l5Ul95LHVzRlr4uSpCehwpZWaHvOOPwqDYydl/l1c67SypfoXcvGU9jHtW9B39+Y fQpg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kuCWLFkB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-82497-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82497-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id c16-20020a170903235000b001dcb3b34b57si446850plh.101.2024.02.26.17.01.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 17:01:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82497-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kuCWLFkB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-82497-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82497-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 27BA2B220F3 for ; Tue, 27 Feb 2024 01:00:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 00F3B46AF; Tue, 27 Feb 2024 00:59:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kuCWLFkB" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 24DBC1847 for ; Tue, 27 Feb 2024 00:59:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708995598; cv=none; b=u3/J+MeJcoxnKIhxWFV+wePXTKg+Mo/7HYCn2HRSMFn9V5Ac20Vb1mM5bAE3GeAT5veBxLkfUsVf6+QCdXAKqwGm87XBJW3pVZHPhee3qQvKs87VQf8rMOd4/TExsCsPZ+mHzQ5E76DXU9XcBq2MPB2D/NwT3dBEZfkqpk8vzW8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708995598; c=relaxed/simple; bh=PWnCDVadzwnCzOJQlQa+l48fd4sQecfuYbwfY7CEwaU=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=GMzlQcZe8JuZHta8eMue279U6e3E4W9Q99zW4GwChnpNYPx8UM6nhv6VG/20Uv+FrNvxu0UfcxbrfjgQG9/browry6jJPfkFRFiydX1k5c6DDrapqeJJr+EIOoY9OkuhPunPGYRctn9oZO3OstT5IbESXycLPG2/M/VKw0N/e3w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kuCWLFkB; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E82D9C433C7; Tue, 27 Feb 2024 00:59:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708995598; bh=PWnCDVadzwnCzOJQlQa+l48fd4sQecfuYbwfY7CEwaU=; h=Date:From:To:Subject:References:In-Reply-To:From; b=kuCWLFkBYrC5qwm8KigVMjHB13jWyY1zqGAAZKA0HxmFMFZmydp1RcPLppjU8TQGw YMJxCMLoUVvpufpXx8ANbyax3TH1UXo4qWeNdaZvQP2Mb4NKsZXRcW1GA2j9bFZIoI fvC3/5wW1lx5xB8NplQCwRyqkHYXRyurbr3VE+bJGNyDQbekMDUodCxnYshV3pqzfP l0/yZ7rthdNyTfw2cJD7WBay1bte7RMVw0NuPMim4+lGZcVdCeaWv70TUw2XqXGj5R OrgeB5EXCV1ZaGVqewaxmzS1t6cF/H7PsbM+GMeSzFLxRgG5hS/qGWrrmJuPrJFAKX dJm8YtMhYYsUg== Date: Mon, 26 Feb 2024 16:59:56 -0800 From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Subject: Re: [PATCH 2/5 v2] f2fs: fix write pointers all the time Message-ID: References: <20240223205535.307307-1-jaegeuk@kernel.org> <20240223205535.307307-2-jaegeuk@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240223205535.307307-2-jaegeuk@kernel.org> Even if the roll forward recovery stopped due to any error, we have to fix the write pointers in order to mount the disk from the previous checkpoint. Signed-off-by: Jaegeuk Kim --- from v1: - preserve error fs/f2fs/recovery.c | 15 +++++++-------- fs/f2fs/super.c | 11 +++++++---- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c index b3baec666afe..3078d5613748 100644 --- a/fs/f2fs/recovery.c +++ b/fs/f2fs/recovery.c @@ -863,7 +863,6 @@ int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only) int ret = 0; unsigned long s_flags = sbi->sb->s_flags; bool need_writecp = false; - bool fix_curseg_write_pointer = false; if (is_sbi_flag_set(sbi, SBI_IS_WRITABLE)) f2fs_info(sbi, "recover fsync data on readonly fs"); @@ -894,8 +893,6 @@ int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only) else f2fs_bug_on(sbi, sbi->sb->s_flags & SB_ACTIVE); skip: - fix_curseg_write_pointer = !check_only || list_empty(&inode_list); - destroy_fsync_dnodes(&inode_list, err); destroy_fsync_dnodes(&tmp_inode_list, err); @@ -913,11 +910,13 @@ int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only) * and the f2fs is not read only, check and fix zoned block devices' * write pointer consistency. */ - if (!err && fix_curseg_write_pointer && !f2fs_readonly(sbi->sb) && - f2fs_sb_has_blkzoned(sbi)) { - err = f2fs_fix_curseg_write_pointer(sbi); - if (!err) - err = f2fs_check_write_pointer(sbi); + if (f2fs_sb_has_blkzoned(sbi) && !f2fs_readonly(sbi->sb)) { + int err2 = f2fs_fix_curseg_write_pointer(sbi); + + if (!err2) + err2 = f2fs_check_write_pointer(sbi); + if (err2) + err = err2; ret = err; } diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index d91e57ca6110..77348fd0a42b 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -4674,11 +4674,14 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) * If the f2fs is not readonly and fsync data recovery succeeds, * check zoned block devices' write pointer consistency. */ - if (!err && !f2fs_readonly(sb) && f2fs_sb_has_blkzoned(sbi)) { - err = f2fs_check_write_pointer(sbi); - if (err) - goto free_meta; + if (f2fs_sb_has_blkzoned(sbi) && !f2fs_readonly(sb)) { + int err2 = f2fs_check_write_pointer(sbi); + + if (err2) + err = err2; } + if (err) + goto free_meta; f2fs_init_inmem_curseg(sbi); -- 2.44.0.rc1.240.g4c46232300-goog