public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: "Theodore Ts'o" <tytso@mit.edu>
Cc: linux-ext4@vger.kernel.org
Subject: Re: ENOSPC error returned too late
Date: Mon, 18 Aug 2008 16:21:40 +0530	[thread overview]
Message-ID: <20080818105140.GB7808@skywalker> (raw)
In-Reply-To: <20080818093026.GA7808@skywalker>

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@linux.vnet.ibm.com>
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@linux.vnet.ibm.com>

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;

  reply	other threads:[~2008-08-18 10:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-17 12:53 ENOSPC error returned too late Theodore Ts'o
2008-08-18  9:30 ` Aneesh Kumar K.V
2008-08-18 10:51   ` Aneesh Kumar K.V [this message]
2008-08-18 13:30     ` Theodore Tso
2008-08-18 16:44       ` Mingming Cao

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=20080818105140.GB7808@skywalker \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.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