public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* Possible ext2 bug with large sparse files?
@ 2007-06-05 12:25 Mark Knibbs
  2007-06-05 13:56 ` Theodore Tso
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Knibbs @ 2007-06-05 12:25 UTC (permalink / raw)
  To: linux-ext4; +Cc: markk

Hi, 

I have encountered a problem/issue relating to using ext2 filesystems with 
(very) large sparse files, where the file length is much larger than the 
filesystem size. 

I'm using an x86 PC, the same issue appears in kernel 2.6.14 & 2.6.20. Use 
dd 5.97 to replicate the problem. 

On a ~500MB ext2 volume with about 60MB free (a 512MB flash card in a USB 
reader), testing using dd like this:
 dd if=/dev/zero of=test.bin bs=1 count=1 seek=17247252479
works fine, but
 dd if=/dev/zero of=test.bin bs=1 count=1 seek=17247252480
gives a "File size limit exceeded" message and this warning appears in dmesg 
output:
 "EXT2-fs warning (device sdd): ext2_block_to_path: block > big" 

[For whatever reason, it seems the maximum file size for that
partition is 17,247,252,480 bytes. In itself that behaviour isn't 
necessarily a bug; but if you have any clue how the ext2 maximum file size 
is related (or not) to the amount of free space or the volume size, please 
let me know!] 

After doing
 dd if=/dev/zero of=test.bin bs=1 count=1 seek=17247252480
ls -l shows test.bin to be 17247252480 bytes long. 

I unmounted the partition and used e2fsck -f to check it:
 # e2fsck -f /dev/sdd
 e2fsck 1.38 (30-Jun-2005)
 Pass 1: Checking inodes, blocks, and sizes
 Inode 123466, i_size is 17247252480, should be 0.  Fix<y>? yes 

 Pass 2: Checking directory structure
 Pass 3: Checking directory connectivity
 Pass 4: Checking reference counts
 Pass 5: Checking group summary information 

 VolName: ***** FILE SYSTEM WAS MODIFIED *****
 VolName: 107/125488 files (2.8% non-contiguous), 428147/501760 blocks 


Regards,
 -- Mark 

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: Possible ext2 bug with large sparse files?
@ 2007-06-06 13:18 Mark Knibbs
  2007-06-07 17:51 ` Andreas Dilger
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Knibbs @ 2007-06-06 13:18 UTC (permalink / raw)
  To: linux-ext4; +Cc: markk

Hi, 

This is a follow-up to my previous message. The bug is also present in ext3, 
and applies to partitions with 2K blocks and (at least in part) to those 
with 4K blocks. There is also another issue, which may well be a bug in 
e2fsck. 

For partitions with 2K blocks the maximum file size is 275,415,851,008 
bytes; changing the seek= argument in the dd examples to 275415851007 & 
275415851008 gives similar results. 

The maximum file size on partitions with 4K blocks is 2,196,875,759,616 
bytes, so I tested using dd with seek=2196875759615 & 2196875759616. With 4K 
blocks there don't seem to be any problems with warnings in dmesg output, or 
fsck. The only bug (or what I think is a bug) is that
 dd if=/dev/zero of=test.bin bs=1 count=1 seek=2196875759616
causes the file size to show as 2196875759616, but it shouldn't since no 
actual write took place. 


As before, on an ext3 partition with 1K block size, doing
 dd if=/dev/zero of=test.bin bs=1 count=1 seek=17247252480
(which causes the file size to show as 17247252480, but it shouldn't since 
no actual write took place) gives a "File size limit exceeded" message and 
this warning in dmesg output:
 "EXT3-fs warning (device sde): ext3_block_to_path: block > big" 

Unlike the ext2 case however, if you run fsck.ext3 -f it doesn't ask a 
question like
 "i_size is 17247252480, should be 0.  Fix<y>?"
but seems to silently do that; on mounting after running fsck -f, test.bin 
shows as 0 bytes long. 


If instead you do
 dd if=/dev/zero of=test.bin bs=1 count=1 seek=17247252479
(which should work okay, since the maximum file size is 17247252480) then 
fsck -f gives a strange message:
 "Inode 6073, i_size is 17247252480, should be 17247252480.  Fix<y>?"
Even if you say yes to "fix" it, repeatedly running fsck always asks that 
question. 

This happens:
# cd /mnt/sde_removable
# dd if=/dev/zero of=test.bin bs=1 count=1 seek=17247252479
1+0 records in
1+0 records out
1 byte (1 B) copied, 0.132501 seconds, 0.0 kB/s
# ls -l
total 16
drwx------ 2 root root       12288 Jun  6 13:04 lost+found/
 -rw-r--r-- 1 root root 17247252480 Jun  6 13:09 test.bin
# cd ~
# umount /mnt/sde_removable
# fsck.ext3 -f /dev/sde
e2fsck 1.38 (30-Jun-2005)
Pass 1: Checking inodes, blocks, and sizes
Inode 6073, i_size is 17247252480, should be 17247252480.  Fix<y>? yes 

Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information 

Ext3_test: ***** FILE SYSTEM WAS MODIFIED *****
Ext3_test: 12/125488 files (0.0% non-contiguous), 24081/501760 blocks
# mount -t ext3 -o noatime /dev/sde /mnt/sde_removable
# ls -l /mnt/sde_removable
total 16
drwx------ 2 root root       12288 Jun  6 13:04 lost+found/
 -rw-r--r-- 1 root root 17247252480 Jun  6 13:09 test.bin
# umount /mnt/sde_removable
# fsck.ext3 -f /dev/sde
e2fsck 1.38 (30-Jun-2005)
Pass 1: Checking inodes, blocks, and sizes
Inode 6073, i_size is 17247252480, should be 17247252480.  Fix<y>? yes 

Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information 

Ext3_test: ***** FILE SYSTEM WAS MODIFIED *****
Ext3_test: 12/125488 files (0.0% non-contiguous), 24081/501760 blocks 


Regards,
 -- Mark 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-06-07 21:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-05 12:25 Possible ext2 bug with large sparse files? Mark Knibbs
2007-06-05 13:56 ` Theodore Tso
  -- strict thread matches above, loose matches on Subject: below --
2007-06-06 13:18 Mark Knibbs
2007-06-07 17:51 ` Andreas Dilger
2007-06-07 21:40   ` Mark Knibbs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox