All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Christian Holtje <docwhat@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: pread() over NFS (again) [1.5.5.4]
Date: Thu, 26 Jun 2008 16:46:06 -0400	[thread overview]
Message-ID: <20080626204606.GX11793@spearce.org> (raw)
In-Reply-To: <6F25C1B4-85DE-4559-9471-BCD453FEB174@gmail.com>

Christian Holtje <docwhat@gmail.com> wrote:
> I have read all the threads on git having trouble with pread() and I  
> didn't see anything to help.
...
>   Receiving objects: 100% (253/253), 5.27 MiB | 9136 KiB/s, done.
>   fatal: cannot pread pack file: No such file or directory
>   fatal: index-pack failed
> 
> The end of the strace looks like so:
> pread(3, "", 205, 1373)                 = 0
> write(2, "fatal: cannot pread pack file: N"..., 57) = 57

Hmmph.  So pread for a length of 205 can return 0 on NFS?  Is this
a transient error?  If so, perhaps a patch like this might help:

diff --git a/index-pack.c b/index-pack.c
index 5ac91ba..737f757 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -309,14 +309,19 @@ static void *get_data_from_pack(struct object_entry *obj)
 	unsigned char *src, *data;
 	z_stream stream;
 	int st;
+	int attempts = 0;
 
 	src = xmalloc(len);
 	data = src;
 	do {
 		ssize_t n = pread(pack_fd, data + rdy, len - rdy, from + rdy);
-		if (n <= 0)
+		if (n <= 0) {
+			if (n == 0 && ++attempts < 10)
+				continue;
 			die("cannot pread pack file: %s", strerror(errno));
+		}
 		rdy += n;
+		attempts = 0;
 	} while (rdy < len);
 	data = xmalloc(obj->size);
 	memset(&stream, 0, sizeof(stream));


The file shouldn't be short unless someone truncated it, or there
is a bug in index-pack.  Neither is very likely, but I don't think
we would want to retry pread'ing the same block forever.

-- 
Shawn.

  reply	other threads:[~2008-06-26 20:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-26 16:40 pread() over NFS (again) [1.5.5.4] Christian Holtje
2008-06-26 20:46 ` Shawn O. Pearce [this message]
2008-06-26 20:56   ` Junio C Hamano
2008-06-26 21:05     ` Shawn O. Pearce
2008-06-26 21:36       ` Christian Holtje
2008-06-26 22:04       ` Junio C Hamano
2008-06-26 22:07         ` Shawn O. Pearce
2008-06-26 23:36     ` logank
2008-06-26 23:38       ` Junio C Hamano
2008-06-27  2:57         ` J. Bruce Fields
2008-06-27 14:50           ` Trond Myklebust
2008-06-30  0:32             ` Shawn O. Pearce
2008-06-30 19:09               ` Nicolas Pitre
2008-06-27  2:54       ` J. Bruce Fields
2008-06-27 13:44         ` Christian Holtje
2008-06-27 13:54       ` Christian Holtje

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=20080626204606.GX11793@spearce.org \
    --to=spearce@spearce.org \
    --cc=docwhat@gmail.com \
    --cc=git@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.