Skip to contentSkip to conversation

erofs-utils: mount: nbd: retry indefinitely on network I/O errors

PATCH New Gao Xiang 1 participant 1 message Oct 10, 2025

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs-utils: mount: nbd: retry indefinitely on network I/O errors

Due to an NBD protocol limitation, the status code for erofs_nbd_send_reply_header() has already been sent before the data arrives.

A better solution will be considered later.

---
 mount/main.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
mount/main.c +3 -5
index d98e1e9..ccf4193 100644
@@ -596,11 +596,9 @@ static void *erofsmount_nbd_loopfn(void *arg)
 
 		erofs_nbd_send_reply_header(ctx->sk.fd, rq.cookie, 0);
 		pos = rq.from;
-		rem = erofs_io_sendfile(&ctx->sk, &ctx->vd, &pos, rq.len);
-		if (rem < 0) {
-			err = -errno;
-			break;
-		}
+		do {
+			rem = erofs_io_sendfile(&ctx->sk, &ctx->vd, &pos, rq.len);
+		} while (rem < 0);
 		err = __erofs_0write(ctx->sk.fd, rem);
 		if (err) {
 			if (err > 0)
Signature · 1 line
2.43.5