Skip to contentSkip to conversation

drbd:don't increase unacked_cnt when resync write error

PATCH In review Rui Xu 2 participants 3 messages Feb 18, 2022 – Apr 28, 2022 DRBD driver

lore
Share & tools
lore

Rui Xu

author
#0 lore raw

PATCH 1/1 drbd:don't increase unacked_cnt when resync write error

In drbd_endio_write_sec_final, if a write error has occured and protocol is not 'C', inc_unacked will be called.

But when it is a resync write, we shouldn't increase the unacked_cnt there because of there is no corresponding dec_unacked, then unacked_cnt will never be zero, which leads to the problem that in do_start_resync, start_resync_timer will be added over and over again and will never end.

Fix this problem by adding a determine, when resync write error, don't increase unacked_cnt in drbd_endio_write_sec_final.

---
 drbd/drbd_sender.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drbd/drbd_sender.c +1 -1
index 7238730..aaccd07 100644
@@ -148,7 +148,7 @@ void drbd_endio_write_sec_final(struct drbd_peer_request *peer_req) __releases(l
 	sector = peer_req->i.sector;
 	block_id = peer_req->block_id;
 
-	if (peer_req->flags & EE_WAS_ERROR) {
+	if ((peer_req->flags & EE_WAS_ERROR) && (block_id != ID_SYNCER)) {
                 /* In protocol != C, we usually do not send write acks.
                  * In case of a write error, send the neg ack anyways. */
                 if (!__test_and_set_bit(__EE_SEND_WRITE_ACK, &peer_req->flags))
Signature · 1 line
1.8.3.1
#1 lore raw

Looks good to me for drbd-9.0. We would have to take care with the merge up to the actively maintained branches in order to avoid losing the drbd_handle_io_error() call. I suggest we just add the condition to the !__test_and_set_bit(__EE_SEND_WRITE_ACK,...) check. The extra drbd_set_out_of_sync() call is harmless and it keeps the branches similar.

Best regards,
Joel

#2 lore raw

Applied as
https://github.com/LINBIT/drbd/commit/ecd0bd0c884ae7171b62c38b8f2c56a333898bc5

Thanks!
Joel

Quoted 10 lines · Joel Colledge

Looks good to me for drbd-9.0. We would have to take care with the merge up to the actively maintained branches in order to avoid losing the drbd_handle_io_error() call. I suggest we just add the condition to the !__test_and_set_bit(__EE_SEND_WRITE_ACK,...) check. The extra drbd_set_out_of_sync() call is harmless and it keeps the branches similar.

Best regards,
Joel