From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 From: Venkatesh Srinivas Date: Sun, 23 Aug 2009 11:10:28 -0400 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: [9fans] Possible bug in p9p venti? Topicbox-Message-UUID: 52041552-ead5-11e9-9d60-3106f5b1d025 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