[PATCH] drbd: only send P_PEERS_IN_SYNC for up to 4 MiB in resync progress
zhengbing.huang
zhengbing.huang at easystack.cn
Fri Dec 12 09:55:20 CET 2025
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 at 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
More information about the drbd-dev
mailing list