From: "zhengbing.huang" <zhengbing.huang@easystack.cn>
To: drbd-dev@lists.linbit.com
Subject: [PATCH] drbd: only send P_PEERS_IN_SYNC for up to 4 MiB in resync progress
Date: Fri, 12 Dec 2025 16:55:20 +0800 [thread overview]
Message-ID: <20251212085520.2910741-1-zhengbing.huang@easystack.cn> (raw)
During the resync process, the range of resync is not continuous.
If the next sync position is very far from the current sync position,
it will cause the same problem as commit: e2d0439f9
("drbd: only send P_PEERS_IN_SYNC for up to 4 MiB when resync finished").
The solution is to ensure that P_PEERS_IN_SYNC within a range of 4 MiB is sent each time.
Fixes: bc218ad64640 ("drbd: only send P_PEERS_IN_SYNC every 4MiB")
Signed-off-by: zhengbing.huang <zhengbing.huang@easystack.cn>
---
drbd/drbd_receiver.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drbd/drbd_receiver.c b/drbd/drbd_receiver.c
index 3eed5d33e..08032dd73 100644
--- a/drbd/drbd_receiver.c
+++ b/drbd/drbd_receiver.c
@@ -2352,6 +2352,7 @@ void drbd_queue_update_peers(struct drbd_peer_device *peer_device,
static void drbd_peers_in_sync_progress(struct drbd_peer_device *peer_device, sector_t sector_end)
{
+ sector_t boundary_end, send_end;
/* Round down to the boundary defined by PEERS_IN_SYNC_STEP_SHIFT. */
sector_t peers_in_sync_end = sector_end & ~PEERS_IN_SYNC_STEP_SECT_MASK;
@@ -2365,7 +2366,14 @@ static void drbd_peers_in_sync_progress(struct drbd_peer_device *peer_device, se
if (peers_in_sync_end == peer_device->last_peers_in_sync_end)
return;
- drbd_queue_update_peers(peer_device, peer_device->last_peers_in_sync_end, peers_in_sync_end);
+ /* Ensure send range does not over 4 MiB */
+ send_end = peers_in_sync_end;
+ boundary_end = min(get_capacity(peer_device->device->vdisk),
+ (peer_device->last_peers_in_sync_end | PEERS_IN_SYNC_STEP_SECT_MASK) + 1);
+ if (peers_in_sync_end > boundary_end)
+ send_end = boundary_end;
+
+ drbd_queue_update_peers(peer_device, peer_device->last_peers_in_sync_end, send_end);
peer_device->last_peers_in_sync_end = peers_in_sync_end;
/* Also consider scheduling a bitmap update to reduce the size of the
--
2.43.0
reply other threads:[~2025-12-12 9:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251212085520.2910741-1-zhengbing.huang@easystack.cn \
--to=zhengbing.huang@easystack.cn \
--cc=drbd-dev@lists.linbit.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox