Your message dated Sun, 12 Jul 2009 11:09:35 +0200
with message-id <[email protected]>
and subject line Fixed
has caused the Debian Bug report #513568,
regarding nbd-server: reports wrong size with 3TB devices on 32-bit systems
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
513568: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=513568
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: nbd-server
Version: 1:2.9.11-2
Severity: normal

Steps to reproduce:
0) make sure /dev/md0 has size of 3000614518784 bytes
1) nbd-server 2000 /dev/md0
2) nc localhost 2000 | hexdump -C

Expected results:
2) netcat shows the NBD init packet, second row starts with
   0x000002baa2900000 as this is the size of the device in hex.

Actual results:
2) netcat shows the NBD init packet, second row starts with
   0x000000baa2900000 which is NOT the size of the block device.

00000000  4e 42 44 4d 41 47 49 43  00 00 42 02 81 86 12 53  |NBDMAGIC..B....S|
00000010  00 00 00 ba a2 90 00 00  00 00 00 01 00 00 00 00  |................|

   It seems that nbd-server is for some reason zeroing the upper three
   bytes of the size field and preventing the use of such large devices.

More info:
1) nbd-server logs

Jan 30 11:36:09 nbd_server[6740]: Size of exported file/device is 801591263232

which is 0x000000baa2900000 in hex and incorrect.

2) It seems that the kernel API returns 'unsigned long' count of
512-byte sectors. On this 32-bit system 'unsigned long' is 4 bytes so
this interface is not sufficient to support 3TB:

off_t size_autodetect(int fhandle) {
        off_t es;
        unsigned long sectors;
        struct stat stat_buf;
        int error;

#ifdef HAVE_SYS_MOUNT_H
#ifdef HAVE_SYS_IOCTL_H
#ifdef BLKGETSIZE
        DEBUG("looking for export size with ioctl BLKGETSIZE\n");
        if (!ioctl(fhandle, BLKGETSIZE, &sectors) && sectors) {
                es = (off_t)sectors * (off_t)512;

3) In addition, off_t is also only 4 bytes so even if I manually
specify the right size of the block device I still get wrong size back:

$ nbd-server 2000 /dev/md0 3000614518784
$ nc localhost 2000|hexdump -C
00000000  4e 42 44 4d 41 47 49 43  00 00 42 02 81 86 12 53  |NBDMAGIC..B....S|
00000010  00 00 00 ba a2 90 00 00  00 00 00 01 00 00 00 00  |................|



--- End Message ---
--- Begin Message ---
Version: 1:2.9.13-1

Forgot to mention this in the changelog, but the latest version of nbd
fixes this bug

-- 
The biometric identification system at the gates of the CIA headquarters
works because there's a guard with a large gun making sure no one is
trying to fool the system.
  http://www.schneier.com/blog/archives/2009/01/biometrics.html


--- End Message ---

Reply via email to