[ENBD] stability issues

Peter T. Breuer enbd@lists.community.tummy.com
Fri, 22 Mar 2002 19:38:58 +0100 (MET)


"A month of sundays ago Peter T. Breuer wrote:"
> What I would like you to do is to eliminate the VM buffer system as
> a possible cause of problems. Can you do
> 
>    /sbin/raw /dev/raw1 /dev/hda
>    (for example)
> 
> and then perform the nbd-test suite against /dev/raw1? This is

I must say, I couldn't write to the raw device with a simple test
program! But dd managed it just fine! What a mystery.

int main() {
   int fd = open("/dev/raw1",  O_WRONLY|O_CREAT|O_TRUNC|0x8000, 0666);
   int n = write(fd,"hello",6);
   printf("printed %d of %d bytes to %d: %m\n", n, 6, fd);
  return 0;
}

   open("/dev/raw1", O_WRONLY|O_CREAT|O_TRUNC|0x8000, 0666) = 3
   write(3, "hello\0", 6)                  = -1 EINVAL (Invalid argument)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

And with dd

   sudo strace dd if=/dev/zero count=1 of=/dev/raw1
   ...

   open("/dev/raw1", O_WRONLY|O_CREAT|O_TRUNC|0x8000, 0666) = 1
   rt_sigaction(SIGINT, NULL, {SIG_DFL}, 8) = 0
   rt_sigaction(SIGINT, {0x8049328, [], 0x4000000}, NULL, 8) = 0
   rt_sigaction(SIGQUIT, NULL, {SIG_DFL}, 8) = 0
   rt_sigaction(SIGQUIT, {0x8049328, [], 0x4000000}, NULL, 8) = 0
   rt_sigaction(SIGPIPE, NULL, {SIG_DFL}, 8) = 0
   rt_sigaction(SIGPIPE, {0x8049328, [], 0x4000000}, NULL, 8) = 0
   rt_sigaction(SIGUSR1, NULL, {SIG_DFL}, 8) = 0
   rt_sigaction(SIGUSR1, {0x804938c, [], 0x4000000}, NULL, 8) = 0
   brk(0x8053000)                          = 0x8053000
   read(0, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"...,512) = 512
   write(1, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
   write(2, "1+0 records in\n", 151+0 records in

Which has me very very puzzled. Any explanations? Is there some special
way of writing to a character device that I don't know about and which
dd does?



Apart from that matter, I would suggest also varying the kernel down to
2.4.8 and seeing if there's a difference.  I can also supply the driver
for the 2.5.1 kernel, and possibly later.


Peter