Bug 9329 - ext4: delalloc space accounting problem drops data
Summary: ext4: delalloc space accounting problem drops data
Status: CLOSED CODE_FIX
Alias: None
Product: File System
Classification: Unclassified
Component: ext4 (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Mingming Cao
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-08 09:42 UTC by Eric Sandeen
Modified: 2008-08-22 12:39 UTC (History)
0 users

See Also:
Kernel Version: 2.6.24-rc1
Subsystem:
Regression: ---
Bisected commit-id:


Attachments

Description Eric Sandeen 2007-11-08 09:42:10 UTC
2.6.24-rc1 + ext4 git patch queue from last week or so.

It appears that delalloc does not track used space properly, and fails to return ENOSPC as appropriate:

[root@bear-05 ~]# mkfs.ext3 -I 256 /dev/sdb7 32768
[root@bear-05 ~]# mount -t ext4dev -o data=writeback,delalloc,extents,mballoc /dev/sdb7 /mnt/test
[root@bear-05 ~]# df -h /mnt/test
Filesystem            Size  Used Avail Use% Mounted on
/dev/sdb7              30M  4.5M   24M  16% /mnt/test
[root@bear-05 ~]# du -h /tmp/1Mfile 
1.1M    /tmp/1Mfile
[root@bear-05 ~]# for I in `seq 1 50`; do cp /tmp/1Mfile /mnt/test/1Mfile-$I; done
[root@bear-05 ~]# df -h /mnt/test
Filesystem            Size  Used Avail Use% Mounted on
/dev/sdb7              30M   30M     0 100% /mnt/test

all resulting files are 1M in length:
[root@bear-05 ~]# ls -l /mnt/test/1M* | grep -v 1048576
[root@bear-05 ~]# ls -l /mnt/test/1M* | grep 1048576 | wc -l
50
but many of them have silently dropped data on the floor:
[root@bear-05 ~]# du -hc /mnt/test/1Mfile-* | grep -v "1.0M"
596K    /mnt/test/1Mfile-26
0       /mnt/test/1Mfile-27
0       /mnt/test/1Mfile-28
0       /mnt/test/1Mfile-29
0       /mnt/test/1Mfile-30
<snip>

When mounted with nodelalloc, I get proper behavior:

[root@bear-05 ~]# for I in `seq 1 50`; do cp /tmp/1Mfile /mnt/test/1Mfile-$I; done
cp: writing `/mnt/test/1Mfile-26': No space left on device
cp: writing `/mnt/test/1Mfile-27': No space left on device
cp: writing `/mnt/test/1Mfile-28': No space left on device
cp: writing `/mnt/test/1Mfile-29': No space left on device
<snip>
Comment 1 Anonymous Emailer 2007-11-08 10:09:51 UTC
Reply-To: akpm@linux-foundation.org

> On Thu,  8 Nov 2007 09:42:10 -0800 (PST) bugme-daemon@bugzilla.kernel.org
> wrote:
> http://bugzilla.kernel.org/show_bug.cgi?id=9329
> 
>            Summary: ext4: delalloc space accounting problem drops data
>            Product: File System
>            Version: 2.5
>      KernelVersion: 2.6.24-rc1
>           Platform: All
>         OS/Version: Linux
>               Tree: Mainline
>             Status: NEW
>           Severity: normal
>           Priority: P1
>          Component: ext4
>         AssignedTo: fs_ext4@kernel-bugs.osdl.org
>         ReportedBy: sandeen@redhat.com
> 
> 
> 2.6.24-rc1 + ext4 git patch queue from last week or so.
> 
> It appears that delalloc does not track used space properly, and fails to
> return ENOSPC as appropriate:
> 
> [root@bear-05 ~]# mkfs.ext3 -I 256 /dev/sdb7 32768
> [root@bear-05 ~]# mount -t ext4dev -o data=writeback,delalloc,extents,mballoc
> /dev/sdb7 /mnt/test
> [root@bear-05 ~]# df -h /mnt/test
> Filesystem            Size  Used Avail Use% Mounted on
> /dev/sdb7              30M  4.5M   24M  16% /mnt/test
> [root@bear-05 ~]# du -h /tmp/1Mfile 
> 1.1M    /tmp/1Mfile
> [root@bear-05 ~]# for I in `seq 1 50`; do cp /tmp/1Mfile /mnt/test/1Mfile-$I;
> done
> [root@bear-05 ~]# df -h /mnt/test
> Filesystem            Size  Used Avail Use% Mounted on
> /dev/sdb7              30M   30M     0 100% /mnt/test
> 
> all resulting files are 1M in length:
> [root@bear-05 ~]# ls -l /mnt/test/1M* | grep -v 1048576
> [root@bear-05 ~]# ls -l /mnt/test/1M* | grep 1048576 | wc -l
> 50
> but many of them have silently dropped data on the floor:
> [root@bear-05 ~]# du -hc /mnt/test/1Mfile-* | grep -v "1.0M"
> 596K    /mnt/test/1Mfile-26
> 0       /mnt/test/1Mfile-27
> 0       /mnt/test/1Mfile-28
> 0       /mnt/test/1Mfile-29
> 0       /mnt/test/1Mfile-30
> <snip>
> 
> When mounted with nodelalloc, I get proper behavior:
> 
> [root@bear-05 ~]# for I in `seq 1 50`; do cp /tmp/1Mfile /mnt/test/1Mfile-$I;
> done
> cp: writing `/mnt/test/1Mfile-26': No space left on device
> cp: writing `/mnt/test/1Mfile-27': No space left on device
> cp: writing `/mnt/test/1Mfile-28': No space left on device
> cp: writing `/mnt/test/1Mfile-29': No space left on device
> <snip>
> 
> 
> -- 
> Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug, or are watching someone who is.
Comment 2 Mingming Cao 2008-08-22 12:39:11 UTC
Eric, we have delalloc block reservation that prevent ENOSPC in 2.6.27-rc3. I am closing this bug.

thanks,

Note You need to log in before you can comment on or make changes to this bug.