Skip to content
Permalink
Browse files

Change blocksize to 512

1024 bytes was originally chosen as fitting nicely inside an ethernet
frame. That didn't really make much sense, but the issue was masked by
the kernel actually ignoring block sizes due to a bug.

Now that the kernel bug is fixed, the result is that partitions are
parsed incorrectly, resulting in confusing behaviour.

Fix by defaulting to 512. For the rare case where 1024 bytes still makes
sense, the -b parameter still exists.
  • Loading branch information...
yoe committed Nov 28, 2018
1 parent 8689a6a commit 128fd556286ff5d53c5f2b16c4ae5746b5268a64
Showing with 2 additions and 2 deletions.
  1. +2 −2 nbd-client.c
@@ -910,7 +910,7 @@ void usage(char* errmsg, ...) {
#if HAVE_GNUTLS && !defined(NOTLS)
fprintf(stderr, "All commands that connect to a host also take:\n\t[-F|-certfile certfile] [-K|-keyfile keyfile]\n\t[-A|-cacertfile cacertfile] [-H|-tlshostname hostname] [-x|-enable-tls]\n");
#endif
fprintf(stderr, "Default value for blocksize is 1024 (recommended for ethernet)\n");
fprintf(stderr, "Default value for blocksize is 512\n");
fprintf(stderr, "Allowed values for blocksize are 512,1024,2048,4096\n"); /* will be checked in kernel :) */
fprintf(stderr, "Note, that kernel 2.4.2 and older ones do not work correctly with\n");
fprintf(stderr, "blocksizes other than 1024 without patches\n");
@@ -941,7 +941,7 @@ static const char *short_opts = "-A:b:c:C:d:gH:hK:lnN:pSst:uVx";
int main(int argc, char *argv[]) {
char* port=NBD_DEFAULT_PORT;
int sock, nbd;
int blocksize=1024;
int blocksize=512;
char *hostname=NULL;
char *nbddev=NULL;
int swap=0;

0 comments on commit 128fd55

Please sign in to comment.
You can’t perform that action at this time.