On Fri, Jan 30, 2009 at 11:54:02AM +0200, Timo Juhani Lindfors wrote: > Package: nbd-server > Version: 1:2.9.11-2 > Severity: normal > > Steps to reproduce: > 0) make sure /dev/md0 has size of 3000614518784 bytes
Eh. Hrm. Got some spare disks? ;-) (nvm, I can use sparse files :-) > 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. Hrm. Not good. > 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, §ors) && sectors) { > es = (off_t)sectors * (off_t)512; I'm open to suggestions for another API to use. In the mean time, specifying the device size manually should work... > 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 |................| ... except it doesn't. Not for the reasons you claim, though -- nbd-server is compiled with -D_LARGEFILE_SOURCE -D_FILE_OFFSET_ITS=64, so off_t should be an 8-byte integer, not a 4-byte one. I'll try to debug this ASAP, but help is of course always welcome. As a workaround, you should be able to use the "multiple file" option -- though I guess that might be quite hard if sharing the individual block devices that make up md0 is not an option. I also haven't tried that with 3TB files, however... -- <Lo-lan-do> Home is where you have to wash the dishes. -- #debian-devel, Freenode, 2004-09-22 -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org