[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1737425741-3004-1-git-send-email-zhiguo.niu@unisoc.com>
Date: Tue, 21 Jan 2025 10:15:41 +0800
From: Zhiguo Niu <zhiguo.niu@...soc.com>
To: <jaegeuk@...nel.org>, <chao@...nel.org>
CC: <linux-f2fs-devel@...ts.sourceforge.net>, <linux-kernel@...r.kernel.org>,
<niuzhiguo84@...il.com>, <zhiguo.niu@...soc.com>, <ke.wang@...soc.com>,
<Hao_hao.Wang@...soc.com>
Subject: [PATCH] f2fs: fix to avoid changing 'check only' behaior of recovery
The following two 'check only recovery' processes are very dependent on
the return value of f2fs_recover_fsync_data, especially when the return
value is greater than 0.
1. when device has readonly mode, shown as commit
23738e74472f ("f2fs: fix to restrict mount condition on readonly block device")
2. mount optiont NORECOVERY or DISABLE_ROLL_FORWARD is set, shown as commit
6781eabba1bd ("f2fs: give -EINVAL for norecovery and rw mount")
However, commit c426d99127b1 ("f2fs: Check write pointer consistency of open zones")
will change the return value unexpectedly, thereby changing the caller's behavior
This patch let the f2fs_recover_fsync_data return correct value,and not do
f2fs_check_and_fix_write_pointer when the device is read-only.
Fixes: c426d99127b1 ("f2fs: Check write pointer consistency of open zones")
Signed-off-by: Zhiguo Niu <zhiguo.niu@...soc.com>
---
fs/f2fs/recovery.c | 4 +---
fs/f2fs/segment.c | 4 +++-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c
index f35be2c..69a2027 100644
--- a/fs/f2fs/recovery.c
+++ b/fs/f2fs/recovery.c
@@ -899,10 +899,8 @@ 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) {
+ if (!err)
err = f2fs_check_and_fix_write_pointer(sbi);
- ret = err;
- }
if (!err)
clear_sbi_flag(sbi, SBI_POR_DOING);
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 813254d..c9b6d9a 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -5462,7 +5462,9 @@ int f2fs_check_and_fix_write_pointer(struct f2fs_sb_info *sbi)
{
int ret;
- if (!f2fs_sb_has_blkzoned(sbi) || f2fs_readonly(sbi->sb))
+ if (!f2fs_sb_has_blkzoned(sbi) ||
+ f2fs_readonly(sbi->sb) ||
+ f2fs_hw_is_readonly(sbi))
return 0;
f2fs_notice(sbi, "Checking entire write pointers");
--
1.9.1
________________________________
This email (including its attachments) is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. Unauthorized use, dissemination, distribution or copying of this email or the information herein or taking any action in reliance on the contents of this email or the information herein, by anyone other than the intended recipient, or an employee or agent responsible for delivering the message to the intended recipient, is strictly prohibited. If you are not the intended recipient, please do not read, copy, use or disclose any part of this e-mail to others. Please notify the sender immediately and permanently delete this e-mail and any attachments if you received it in error. Internet communications cannot be guaranteed to be timely, secure, error-free or virus-free. The sender does not accept liability for any errors or omissions.
本邮件及其附件具有保密性质,受法律保护不得泄露,仅发送给本邮件所指特定收件人。严禁非经授权使用、宣传、发布或复制本邮件或其内容。若非该特定收件人,请勿阅读、复制、 使用或披露本邮件的任何内容。若误收本邮件,请从系统中永久性删除本邮件及所有附件,并以回复邮件的方式即刻告知发件人。无法保证互联网通信及时、安全、无误或防毒。发件人对任何错漏均不承担责任。
Powered by blists - more mailing lists