From mboxrd@z Thu Jan 1 00:00:00 1970 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 9631D33B6F0; Fri, 9 Jan 2026 12:20:50 +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=1767961250; cv=none; b=R2xv8Sm8VxnmPKnUDyor4idy/4MKJJ3jI1cbL9m2J8M9dFfejguQYfIlLKjfwW9bw+GNwR5/0K15wxLkT5ZSr4GQFyQyMcwJdXaJ3Atad7AG1gVSfGCW4zSnOlrn9RseLYavJTTjcLf++0suxts4C3+yxmINyaMeNqQod1cv93g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767961250; c=relaxed/simple; bh=RcSAC0qLwVfECoVbJHoBGylawvoggYYmgqqwW8wryC0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d5VZhOfkd7iCsxTvez2lQIXpTfFDpaZcVWIL9uXMzecMFWzFSGkXQ/yq4WUlbNy0b+9dpeILotpSnCePHOJ09gupsM0hfV9caqEfCV4YThnhWj0pT+mRf7Zdo9+enIfKont53/rERnPwbi0wKMQYqKk+bCbUvqeDg0ZD8e4L8K4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=fflglKi2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="fflglKi2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A48AC4CEF1; Fri, 9 Jan 2026 12:20:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1767961250; bh=RcSAC0qLwVfECoVbJHoBGylawvoggYYmgqqwW8wryC0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fflglKi2EBMtvg0X1mMjlr6EdCP65rHCR9Za63xY6uI4ljKEa9sqxhyvAAnn/QZyY 5wZvQr55zcRC5R//M1/tmKI+/1/HikApn3EcH5YZpLI+/H9kJ+RlsOx06P59rQPO4g 9YtRh/EG+Jux98aZf9O3zZUxBSPFcT0Bw9liCcRs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable@kernel.org, Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 6.6 688/737] f2fs: fix to propagate error from f2fs_enable_checkpoint() Date: Fri, 9 Jan 2026 12:43:47 +0100 Message-ID: <20260109112159.942319906@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260109112133.973195406@linuxfoundation.org> References: <20260109112133.973195406@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chao Yu [ Upstream commit be112e7449a6e1b54aa9feac618825d154b3a5c7 ] In order to let userspace detect such error rather than suffering silent failure. Fixes: 4354994f097d ("f2fs: checkpoint disabling") Cc: stable@kernel.org Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim [ Adjust context, no rollback ] Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/super.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -2267,9 +2267,10 @@ restore_flag: return err; } -static void f2fs_enable_checkpoint(struct f2fs_sb_info *sbi) +static int f2fs_enable_checkpoint(struct f2fs_sb_info *sbi) { int retry = DEFAULT_RETRY_IO_COUNT; + int ret; /* we should flush all the data to keep data consistency */ do { @@ -2287,10 +2288,14 @@ static void f2fs_enable_checkpoint(struc set_sbi_flag(sbi, SBI_IS_DIRTY); f2fs_up_write(&sbi->gc_lock); - f2fs_sync_fs(sbi->sb, 1); + ret = f2fs_sync_fs(sbi->sb, 1); + if (ret) + f2fs_err(sbi, "%s sync_fs failed, ret: %d", __func__, ret); /* Let's ensure there's no pending checkpoint anymore */ f2fs_flush_ckpt_thread(sbi); + + return ret; } static int f2fs_remount(struct super_block *sb, int *flags, char *data) @@ -2511,7 +2516,9 @@ static int f2fs_remount(struct super_blo if (err) goto restore_discard; } else { - f2fs_enable_checkpoint(sbi); + err = f2fs_enable_checkpoint(sbi); + if (err) + goto restore_discard; } } @@ -4689,13 +4696,12 @@ reset_checkpoint: /* f2fs_recover_fsync_data() cleared this already */ clear_sbi_flag(sbi, SBI_POR_DOING); - if (test_opt(sbi, DISABLE_CHECKPOINT)) { + if (test_opt(sbi, DISABLE_CHECKPOINT)) err = f2fs_disable_checkpoint(sbi); - if (err) - goto sync_free_meta; - } else if (is_set_ckpt_flags(sbi, CP_DISABLED_FLAG)) { - f2fs_enable_checkpoint(sbi); - } + else if (is_set_ckpt_flags(sbi, CP_DISABLED_FLAG)) + err = f2fs_enable_checkpoint(sbi); + if (err) + goto sync_free_meta; /* * If filesystem is not mounted as read-only then