Thread (11 messages) 11 messages, 3 authors, 2021-10-19
STALE1700d
Revisions (5)
  1. v1 [diff vs current]
  2. v2 [diff vs current]
  3. v3 current
  4. v4 [diff vs current]
  5. v5 [diff vs current]

[PATCH -next v3 1/5] ext4: init 'seq' with the value which set in 'ext4_multi_mount_protect'

From: Ye Bin <hidden>
Date: 2021-10-19 06:37:42
Also in: lkml
Subsystem: ext4 file system, filesystems (vfs and infrastructure), the rest · Maintainers: "Theodore Ts'o", Alexander Viro, Christian Brauner, Linus Torvalds

If two host have the same nodename, and seq start from 0, May cause the
detection mechanism to fail.
So init 'seq' with the value which set in 'ext4_multi_mount_protect' to
accelerate conflict detection.

Signed-off-by: Ye Bin <redacted>
---
 fs/ext4/mmp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c
index cebea4270817..11627ff002d3 100644
--- a/fs/ext4/mmp.c
+++ b/fs/ext4/mmp.c
@@ -132,7 +132,7 @@ static int kmmpd(void *data)
 	struct buffer_head *bh = EXT4_SB(sb)->s_mmp_bh;
 	struct mmp_struct *mmp;
 	ext4_fsblk_t mmp_block;
-	u32 seq = 0;
+	u32 seq;
 	unsigned long failed_writes = 0;
 	int mmp_update_interval = le16_to_cpu(es->s_mmp_update_interval);
 	unsigned mmp_check_interval;
@@ -143,6 +143,7 @@ static int kmmpd(void *data)
 	mmp_block = le64_to_cpu(es->s_mmp_block);
 	mmp = (struct mmp_struct *)(bh->b_data);
 	mmp->mmp_time = cpu_to_le64(ktime_get_real_seconds());
+	seq = le32_to_cpu(mmp->mmp_seq);
 	/*
 	 * Start with the higher mmp_check_interval and reduce it if
 	 * the MMP block is being updated on time.
-- 
2.31.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help