From: Andreas Dilger <adilger@turbolabs.com>
To: Helge Hafting <helgehaf@idb.hist.no>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
viro@math.psu.edu
Subject: Re: generic_file_llseek() broken?
Date: Thu, 15 Nov 2001 14:09:17 -0700 [thread overview]
Message-ID: <20011115140917.Q5739@lynx.no> (raw)
In-Reply-To: <20011114165147.S5739@lynx.no> <Pine.LNX.4.33.0111150235330.782-100000@fargo> <20011114222429.Y5739@lynx.no> <3BF38CFB.21998301@idb.hist.no>
In-Reply-To: <3BF38CFB.21998301@idb.hist.no>; from helgehaf@idb.hist.no on Thu, Nov 15, 2001 at 10:38:03AM +0100
On Nov 15, 2001 10:38 +0100, Helge Hafting wrote:
> > On Nov 15, 2001 02:47 +0100, David Gomez wrote:
> > > I did 'dd if=/dev/zero of=test bs=1024k seek=2G' in a 10Gb ide disk, and
> > > guess what ?
> > >
> > > $ ls -l test
> > > -rw-r--r-- 1 huma huma 2251799813685248 Nov 15 02:39 test
> > > $ ls -lh test
> > > -rw-r--r-- 1 huma huma 2.0P Nov 15 02:39 test
> >
> > No, that in itself is fine - it is a sparse file, with a single 1MB block
> > at 2PB offset. If you were to "du" this file, it would say 1MB of allocated
> > space. The problem is that this _should_ be impossible to create on ext2,
> > because the write would be way past the allowed file size limit.
> >
> > > After that, i unmounted the partition and did an fsck, lots of errors and
> > > several files corrupted that fsck ask me to delete because some inodes had
> > > illegal blocks.
> >
> > That is really bad, I don't know how it would happen. Maybe there is
> > overflow internal to ext2, which causes it to write elsewhere in the fs?
> > When was the last time (previous to this problem) you fsck'd this fs?
>
> If he's _allowed_ to create a sparse file with impossible offset - what
> happens to the file's index blocks? I guess that's where something
> overflowed.
I think the problem is not coming from the llseek+write, but maybe from
ftruncate? Strace doesn't show any writes for me (only failed llseek +
lots of reads), yet when trying to create files > 4TB I get "block > big"
and > 8TB I get "block < 0" messages, which come from ext2_block_to_path().
In a couple of places (iblock, offsets) we are using an int/long to
store the block counts, don't know why we want to use a signed value
here instead of an unsigned (long). Looks like changing block numbers
to be unsigned longs goes into the guts of getblk and such. Ugh.
Maybe also sys_truncate should disallow truncating to a size larger
than s_maxbytes. Al? For now, returning EOVERFLOW from do_truncate()
when (length > inode->i_sb->s_maxbytes) should be OK.
Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/
next prev parent reply other threads:[~2001-11-15 21:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-14 23:51 generic_file_llseek() broken? Andreas Dilger
2001-11-15 0:08 ` Alan Cox
2001-11-15 0:46 ` Andreas Dilger
2001-11-15 1:47 ` David Gomez
2001-11-15 5:24 ` Andreas Dilger
[not found] ` <3BF38CFB.21998301@idb.hist.no>
2001-11-15 21:09 ` Andreas Dilger [this message]
2001-11-15 22:02 ` Alan Cox
-- strict thread matches above, loose matches on Subject: below --
2001-11-15 0:55 Andries.Brouwer
2001-11-15 9:02 ` Andreas Dilger
2001-11-15 9:55 ` Trond Myklebust
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=20011115140917.Q5739@lynx.no \
--to=adilger@turbolabs.com \
--cc=helgehaf@idb.hist.no \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@math.psu.edu \
/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