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

Gao Xiang hsiangkao at linux.alibaba.com
Fri Oct 10 17:54:09 AEDT 2025


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.

Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
 mount/main.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/mount/main.c b/mount/main.c
index d98e1e9..ccf4193 100644
--- a/mount/main.c
+++ b/mount/main.c
@@ -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)
-- 
2.43.5



More information about the Linux-erofs mailing list