[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: nbd copy-on-write corruption



On Mon, 2025-05-05 at 18:19 +0200, berend wrote:
> First patch:
> 
> diff --git a/nbd-orig/nbd-server.c b/nbd-patched/nbd-server.c
> index 92fd141..d1d45b2 100644
> --- a/nbd-orig/nbd-server.c
> +++ b/nbd-patched/nbd-server.c
> @@ -1583,6 +1583,7 @@ int expread(READ_CTX *ctx, CLIENT *client) {
>                                 goto fail;
>                         }
>                         confirm_read(client, ctx, rdlen);
> +                       ctx->current_offset += rdlen;
>                 } else { /* the block is not there */
>                         if ((client->server->flags & F_WAIT) &&
> (client->export == NULL)){
>                                 DEBUG("Page %llu is not here, and
> waiting for file\n",


... and I swapped the lines, so I have to respond to my own mail ...

diff --git a/nbd-orig/nbd-server.c b/nbd-patched/nbd-server.c
index 92fd141..18e5ddd 100644
--- a/nbd-orig/nbd-server.c
+++ b/nbd-patched/nbd-server.c
@@ -1582,6 +1582,7 @@ int expread(READ_CTX *ctx, CLIENT *client) {
                        if (pread(client->difffile, buf, rdlen, client-
>difmap[mapcnt]*DIFFPAGESIZE+offset) != rdlen) {
                                goto fail;
                        }
+                       ctx->current_offset += rdlen;
                        confirm_read(client, ctx, rdlen);
                } else { /* the block is not there */
                        if ((client->server->flags & F_WAIT) &&
(client->export == NULL)){


Attachment: publickey - Berend De Schouwer - 0x128CD671.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: