9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Possible bug in p9p venti?
@ 2009-08-23 15:10 Venkatesh Srinivas
  2009-08-23 16:23 ` Russ Cox
  2009-08-26  0:04 ` J.R. Mauro
  0 siblings, 2 replies; 6+ messages in thread
From: Venkatesh Srinivas @ 2009-08-23 15:10 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hi,

I think I've found a bug in p9p's Venti, if anyone were to take a look
at this code or tell me if I'm on the right track, it'd be pretty
neat.

When trying to start Venti on a FreeBSD 8-BETA2 system and a ZFS
filesystem, we got this error:
2009/0822 23:12:30 venti: conf...
2009/0822 23:12:30 err 4: read arena0 offset 0x60000 count 65536 buf
803f20000 returned 65536: No such file or directory
2009/0822 23:12:30 err 4: can't read arena0: read arena0 offset
0x60000 count 65536 buf 803f20000 returned 65536: No such file or
directory
venti: can't init server: can't initialize venti: arena0: can't read
arena0: read arena0 offset 0x60000 count 65536 buf 803f20000 returned
65536: No such

In venti/srv/part.c:325, opsize is clamped at MaxIo, which is 64KB by
default. Later, on :329, we issue a pread for opsize bytes from our
partition, but check that the read returned some multiple of
blocksize. (Blocksize comes from part->fsblocksize, which is gotten by
fstatfs()'s .f_bsize on unix.) This is a problem when MaxIo <
blocksize ; on ZFS on FreeBSD, f_bsize = 128K.

A workaround is to clamp fsblocksize at MaxIo as well:
--- part.c.orig 2009-08-23 11:07:56.000000000 -0400
+++ part.c  2009-08-23 11:06:46.000000000 -0400
@@ -166,6 +166,9 @@
            part->fsblocksize = sfs.f_bsize;
    }
 #endif
+
+   part->fsblocksize = min(part->fsblocksize, MaxIo);
+
    if(subname && findsubpart(part, subname) < 0){
        werrstr("cannot find subpartition %s", subname);
        freepart(part);

Thanks,
-- vs



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-08-26 16:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-23 15:10 [9fans] Possible bug in p9p venti? Venkatesh Srinivas
2009-08-23 16:23 ` Russ Cox
2009-08-26  0:04 ` J.R. Mauro
2009-08-26  0:08   ` erik quanstrom
2009-08-26  2:10     ` Venkatesh Srinivas
2009-08-26 16:14     ` J.R. Mauro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).