Hello List,
I'm attempting to do read some data that includes bad sectors. When NBD
hits this, it goes into an infinite loop reading that particular sector.
I think the correct operation would be to pass the error back the client
and abort the read. The application using the client should be
responsible for dealing with bad sectors, not NBD.
For the particulars, in nbd-server.c (see below), when the expread
request fails, it restarts the while loop without changing len or
attempting to break out of the while loop.
----------
case NBD_CMD_READ:
DEBUG("exp->buf, ");
if (client->transactionlogfd != -1)
writeit(client->transactionlogfd, &reply,
sizeof(reply));
writeit(client->net, &reply, sizeof(reply));
p = buf;
writelen = currlen;
while(len > 0) {
if (expread(request.from, p, currlen, client)) {
DEBUG("Read failed: %m");
ERROR(client, reply, errno);
continue;
}
DEBUG("buf->net, ");
writeit(client->net, buf, writelen);
len -= currlen;
request.from += currlen;
currlen = (len < BUFSIZE) ? len : BUFSIZE;
p = buf;
writelen = currlen;
}
DEBUG("OK!\n");
continue;
----------
--
Dyweni
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Nbd-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nbd-general