9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Venkatesh Srinivas <me@acm.jhu.edu>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: [9fans] Possible bug in p9p venti?
Date: Sun, 23 Aug 2009 11:10:28 -0400	[thread overview]
Message-ID: <f75780240908230810m72cb8407xa80e6238f3a6ae22@mail.gmail.com> (raw)

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



             reply	other threads:[~2009-08-23 15:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-23 15:10 Venkatesh Srinivas [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f75780240908230810m72cb8407xa80e6238f3a6ae22@mail.gmail.com \
    --to=me@acm.jhu.edu \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).