git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Randall S. Becker" <rsbecker@nexbridge.com>
To: "'Torsten Bögershausen'" <tboegi@web.de>,
	"'Joachim Schmitz'" <jojo@schmitz-digital.de>,
	git@vger.kernel.org
Subject: RE: read()  MAX_IO_SIZE bytes, more than SSIZE_MAX?
Date: Sat, 7 Feb 2015 13:06:30 -0500	[thread overview]
Message-ID: <01f201d04300$cce22ca0$66a685e0$@nexbridge.com> (raw)
In-Reply-To: <54D64939.4080102@web.de>

On 2015-02-07 12:30PM Torsten Bögershausen wrote:
>On 2015-02-07 17.45, Joachim Schmitz wrote:
>> Hi there
>> 
>> While investigating the problem with hung git-upload-pack we think to 
>> have found a bug in wrapper.c:
>> 
>> #define MAX_IO_SIZE (8*1024*1024)
>> 
>> This is then used in xread() to split read()s into suitable chunks.
>> So far so good, but read() is only guaranteed to read as much as 
>> SSIZE_MAX bytes at a time. And on our platform that is way lower than 
>> those 8MB (only 52kB, POSIX allows it to be as small as 32k), and as a 
>> (rather strange) consequence mmap() (from compat/mmap.c) fails with 
>> EACCESS (why EACCESS?), because xpread() returns something > 0.
>> 
>> How large is SSIZE_MAX on other platforms? What happens there if you 
>> try to
>> read() more? Should't we rather use SSIZE_MAX on all platforms? If I'm 
>> reading the header files right, on Linux it is LONG_MAX (2TB?), so I 
>> guess we should really go for MIN(8*1024*1024,SSIZE_MAX)?
>How about changing wrapper.c like this: 
>#ifndef MAX_IO_SIZE
> #define MAX_IO_SIZE (8*1024*1024)
>#endif
>---------------------
>and to change config.mak.uname like this:
>ifeq ($(uname_S),NONSTOP_KERNEL)
>	BASIC_CFLAGS += -DMAX_IO_SIZE=(32*1024) Does this work for you ?

Yes, thank you Torsten. I have made this change in our branch (on behalf of
Jojo). I think we can accept it. The (32*1024) does need to be properly
quoted, however.

  parent reply	other threads:[~2015-02-07 18:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-07 16:45 read() MAX_IO_SIZE bytes, more than SSIZE_MAX? Joachim Schmitz
2015-02-07 16:48 ` Joachim Schmitz
2015-02-07 17:19 ` Torsten Bögershausen
2015-02-07 17:29   ` Joachim Schmitz
2015-02-07 18:03     ` Joachim Schmitz
2015-02-07 20:32     ` Torsten Bögershausen
2015-02-07 22:13       ` Junio C Hamano
2015-02-07 22:31         ` Joachim Schmitz
2015-02-08  2:13           ` Junio C Hamano
2015-02-08  2:32             ` Randall S. Becker
2015-02-08 12:05             ` Joachim Schmitz
2015-02-08 17:09               ` Eric Sunshine
2015-02-11 21:13                 ` Junio C Hamano
2015-02-11 21:29                   ` Joachim Schmitz
2015-02-11 22:05                     ` Joachim Schmitz
2015-02-11 23:15                       ` Junio C Hamano
2015-02-07 18:06   ` Randall S. Becker [this message]
2015-02-07 18:20     ` Randall S. Becker
2015-02-07 18:36       ` Joachim Schmitz
2015-02-07 19:14 ` Joachim Schmitz
  -- strict thread matches above, loose matches on Subject: below --
2015-02-12  7:46 Joachim Schmitz

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='01f201d04300$cce22ca0$66a685e0$@nexbridge.com' \
    --to=rsbecker@nexbridge.com \
    --cc=git@vger.kernel.org \
    --cc=jojo@schmitz-digital.de \
    --cc=tboegi@web.de \
    /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).