[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210906144754.2601607-4-yebin10@huawei.com>
Date: Mon, 6 Sep 2021 22:47:51 +0800
From: Ye Bin <yebin10@...wei.com>
To: <tytso@....edu>, <adilger.kernel@...ger.ca>,
<linux-ext4@...r.kernel.org>
CC: <linux-kernel@...r.kernel.org>, <jack@...e.cz>,
Ye Bin <yebin10@...wei.com>
Subject: [PATCH -next 3/6] ext4: compare to local seq and nodename when check conflict
As mmp and check_mmp is point to the same data, so there will never
detect conflict.
To solve this issue just compare to local data.
Signed-off-by: Ye Bin <yebin10@...wei.com>
---
fs/ext4/mmp.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c
index 89797f12a815..0fe7b9ac9db6 100644
--- a/fs/ext4/mmp.c
+++ b/fs/ext4/mmp.c
@@ -154,6 +154,7 @@ static int kmmpd(void *data)
unsigned long last_update_time;
unsigned long last_check_time;
unsigned long diff;
+ char nodename[64];
int retval = 0;
mmp_block = le64_to_cpu(es->s_mmp_block);
@@ -169,8 +170,8 @@ static int kmmpd(void *data)
BUILD_BUG_ON(sizeof(mmp->mmp_bdevname) < BDEVNAME_SIZE);
bdevname(bh->b_bdev, mmp->mmp_bdevname);
- memcpy(mmp->mmp_nodename, init_utsname()->nodename,
- sizeof(mmp->mmp_nodename));
+ memcpy(nodename, init_utsname()->nodename, sizeof(nodename));
+ memcpy(mmp->mmp_nodename, nodename, sizeof(mmp->mmp_nodename));
last_update_time = jiffies;
while (!kthread_should_stop() && !sb_rdonly(sb)) {
@@ -224,8 +225,8 @@ static int kmmpd(void *data)
}
mmp_check = (struct mmp_struct *)(bh_check->b_data);
- if (mmp->mmp_seq != mmp_check->mmp_seq ||
- memcmp(mmp->mmp_nodename, mmp_check->mmp_nodename,
+ if (seq != mmp_check->mmp_seq ||
+ memcmp(nodename, mmp_check->mmp_nodename,
sizeof(mmp->mmp_nodename))) {
dump_mmp_msg(sb, mmp_check,
"Error while updating MMP info. "
--
2.31.1
Powered by blists - more mailing lists