From: Christian Holtje Date: Fri, 27 Jun 2008 13:54:10 GMT Subject: Re: pread() over NFS (again) [1.5.5.4] Message-ID: <590C8EE3-B909-4EE5-8EFA-F5B9031A8C05@gmail.com> In-Reply-To: <65688C06-BB6A-4E95-A4B9-A1A7C206BE2E@sent.com> On Jun 26, 2008, at 7:36 PM, logank@sent.com wrote: > diff --git a/index-pack.c b/index-pack.c > index 5ac91ba..85c8bdb 100644 > --- a/index-pack.c > +++ b/index-pack.c > @@ -313,7 +313,14 @@ static void *get_data_from_pack(struct > object_entry *obj) > src = xmalloc(len); > data = src; > do { > + // It appears that if multiple threads read across NFS, the > + // second read will fail. I know this is awful, but we wait for > + // a little bit and try again. > ssize_t n = pread(pack_fd, data + rdy, len - rdy, from + rdy); > + if (n <= 0) { > + sleep(1); > + n = pread(pack_fd, data + rdy, len - rdy, from + rdy); > + } > if (n <= 0) > die("cannot pread pack file: %s", strerror(errno)); > rdy += n; This does work. But the "unpacking objects" phase becomes very slow. I had 86 objects and I could see every time it did a sleep because the counter would wait a second (or more) before the next object was unpacked. Ciao!