From: Junio C Hamano <gitster@pobox.com>
To: logank@sent.com
Cc: "J. Bruce Fields" <bfields@citi.umich.edu>,
"Shawn O. Pearce" <spearce@spearce.org>,
Christian Holtje <docwhat@gmail.com>,
git@vger.kernel.org
Subject: Re: pread() over NFS (again) [1.5.5.4]
Date: Thu, 26 Jun 2008 16:38:40 -0700 [thread overview]
Message-ID: <7vhcbfojgf.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <65688C06-BB6A-4E95-A4B9-A1A7C206BE2E@sent.com> (logank@sent.com's message of "Thu, 26 Jun 2008 16:36:27 -0700")
logank@sent.com writes:
> On Jun 26, 2008, at 1:56 PM, Junio C Hamano wrote:
>
>>> "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.
>>
>> I don't think we would want to retry even once. Return value of 0
>> from
>> pread is defined to be an EOF, isn't it?
>
> No, it seems to be a simple error-out in this case. We have 2.4.20
> systems with nfs-utils 0.3.3 and used to frequently get the same error
> while pushing. I made a similar change back in February and haven't
> had a problem since:
>
> 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;
>
> I use a sleep request since it seems less likely that the other thread
> will have an outstanding request after a second of waiting.
Gaah. Don't we have NFS experts in house? Bruce, perhaps?
next prev parent reply other threads:[~2008-06-26 23:39 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
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 [this message]
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=7vhcbfojgf.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=bfields@citi.umich.edu \
--cc=docwhat@gmail.com \
--cc=git@vger.kernel.org \
--cc=logank@sent.com \
--cc=spearce@spearce.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 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).