mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@clusterfs.com>
To: "Richard B. Johnson" <root@chaos.analogic.com>
Cc: Matti Aarnio <matti.aarnio@zmailer.org>,
	Linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: Large files
Date: Tue, 10 Jun 2003 12:14:06 -0600	[thread overview]
Message-ID: <20030610121406.D12274@schatzie.adilger.int> (raw)
In-Reply-To: <Pine.LNX.4.53.0306101057020.4326@chaos>; from root@chaos.analogic.com on Tue, Jun 10, 2003 at 11:12:55AM -0400

On Jun 10, 2003  11:12 -0400, Richard B. Johnson wrote:
> > On Tue, Jun 10, 2003 at 09:57:57AM -0400, Richard B. Johnson wrote:
> > > With 32 bit return values, ix86 Linux has a file-size limitation
> > > which is currently about 0x7fffffff. Unfortunately, instead of
> > > returning from a write() with a -1 and errno being set, so that
> > > a program can do something about it, write() executes a signal(25)
> > > which kills the task even if trapped. Is this one of those <expletive
> > > deleted> POSIX requirements or is somebody going to fix it?
> >
> >   http://www.sas.com/standards/large.file/
> >
> > #define SIGXFSZ    25    /* File size limit exceeded (4.2 BSD). */
> >
> > from  fs/buffer.c:
> >
> >         err = -EFBIG;
> >         limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
> >         if (limit != RLIM_INFINITY && size > (loff_t)limit) {
> >                 send_sig(SIGXFSZ, current, 0);
> >                 goto out;
> >         }
> >         if (size > inode->i_sb->s_maxbytes)
> >                 goto out;
> >
> >
> 
> On the system that fails, there are no ulimits and it's the root
> account, therefore I don't know how to set the above limit to
> RLIM_INFINITY (~0LU).  It's also version  2.4.20. I don't think
> it has anything to do with 'rlim' shown above. In any event
> sending a signal when the file-size exceeds some level is preposterous.
> The write should return -1 and errno should have been set to EFBIG
> (in user space). That allows the user's database to create another
> file and keep on trucking instead of blowing up and destroying the
> user's inventory or whatever else was in process.
> 
> FYI, this caused the failure of a samba server for M$ stuff. It
> gives the impression of Linux being defective. This is not good.

If your application is not compiled with O_LARGEFILE, you will also
get SIGXFSZ if you try to write past the 2GB limit.  This is to avoid
your application corrupting data by trying to store a 64-bit file
size in an (apparently) 32-bit data value (32-bit because you didn't
specify O_LARGEFILE).

I don't see anything in signal(7) which says that SIGXFSZ(25) can't be
caught and handled by the application, but at that point you may as
well just fix the app to just open the file with O_LARGEFILE and handle
64-bit file offsets properly.

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/


  parent reply	other threads:[~2003-06-10 18:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-10 13:57 Richard B. Johnson
2003-06-10 14:16 ` ZCane, Ed (Test Purposes)
2003-06-10 14:17 ` Matti Aarnio
2003-06-10 15:12   ` Richard B. Johnson
2003-06-10 17:25     ` Martin Mares
2003-06-10 18:14     ` Andreas Dilger [this message]
2003-06-10 22:12     ` Rob Landley
2003-06-10 20:14 ` David Schwartz
2003-06-10 20:31   ` Richard B. Johnson
2003-06-10 22:38 Ray Lee

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=20030610121406.D12274@schatzie.adilger.int \
    --to=adilger@clusterfs.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matti.aarnio@zmailer.org \
    --cc=root@chaos.analogic.com \
    /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

all inboxes | Powered by JetHome®