On Mon, Aug 18, 2008 at 03:00:26PM +0530, Aneesh Kumar K.V wrote: > On Sun, Aug 17, 2008 at 08:53:11AM -0400, Theodore Ts'o wrote: > > > > While trying to track down kernel BZ #11341 (which is really an > > e2fsprogs bug, not a 2.6.26 regression) I created a fresh ext4 > > filesystem which was 5GB in length, and then filled it to ENOSPC via: > > > > dd if=/dev/zero of=/mnt/bigfile bs=1024 count=10485760 > > > > Unfortunately, it sent the ENOSPC few blocks too late, so the following > > appeared in dmesg, and an attempt to umount the filesystem hung in D > > wait. :-( > > > > - Ted > > > > > > [63518.930337] mpage_da_map_blocks block allocation failed for inode 12 at logical offset 1254547 with max blocks 2 with error -28 > > [63518.930337] This should not happen.!! Data will be lost > > I will look into this. Are we really out of free space or is it that > mballoc is not able to find free space ?. I am not able to reproduce > this here. Will try more. > > How about commit 08085a642ac6e7c3bfae0b6daf538e64a99695b2 Author: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxxxxxxx> Date: Mon Aug 18 16:20:39 2008 +0530 ext4: make sure ext4_has_free_blocks return 0 for ENOSPC Fix ext4_has_free_blocks to return 0 when we don't have enought space. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxxxxxxx> diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 27323cd..dfe2d4f 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c @@ -1628,6 +1628,9 @@ ext4_fsblk_t ext4_has_free_blocks(struct ext4_sb_info *sbi, free_blocks = percpu_counter_sum_and_set(&sbi->s_freeblocks_counter); #endif + if (free_blocks <= root_blocks) + /* we don't have free space */ + return 0; if (free_blocks - root_blocks < nblocks) return free_blocks - root_blocks; return nblocks; -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html