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: ext4 development <linux-ext4@vger.kernel.org>
Subject: Re: ENOSPC returned during writepages
Date: Wed, 20 Aug 2008 16:16:44 +0530	[thread overview]
Message-ID: <20080820104644.GA11267@skywalker> (raw)
In-Reply-To: <20080820054339.GB6381@skywalker>

On Wed, Aug 20, 2008 at 11:13:39AM +0530, Aneesh Kumar K.V wrote:
> Hi,
> 
> I am getting this even with the latest patch queue. The test program is
> a modified fsstress with fallocate support.
> 
> mpage_da_map_blocks block allocation failed for inode 377954 at logical
> offset 313 with max blocks 4 with error -28
> mpage_da_map_blocks block allocation failed for inode 336367 at logical
> offset 74 with max blocks 9 with error -28
> mpage_da_map_blocks block allocation failed for inode 345560 at logical
> offset 542 with max blocks 7 with error -28
> This should not happen.!! Data will be lost
> mpage_da_map_blocks block allocation failed for inode 355317 at logical
> offset 152 with max blocks 10 with error -28
> This should not happen.!! Data will be lost
> mpage_da_map_blocks block allocation failed for inode 395261 at logical
> offset 462 with max blocks 1 with error -28
> This should not happen.!! Data will be lost
> mpage_da_map_blocks block allocation failed for inode 323784 at logical
> offset 313 with max blocks 11 with error -28
> This should not happen.!! Data will be lost
> 

I tried this patch. There are still multiple ways we can get wrong free
block count. The patch reduced the number of errors. So we are doing
better with patch. But I guess we can't use the percpu_counter based
free block accounting with delalloc. Without delalloc it is ok even if
we find some wrong free blocks count . The actual block allocation will fail in
that case and we handle it perfectly fine. With delalloc we cannot
afford to fail the block allocation. Should we look at a free block
accounting rewrite using simple ext4_fsblk_t and and a spin lock ?

diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index dfe2d4f..00934b1 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -1624,7 +1624,7 @@ ext4_fsblk_t ext4_has_free_blocks(struct ext4_sb_info *sbi,
 		(sbi->s_resgid == 0 || !in_group_p(sbi->s_resgid)))
 		root_blocks = ext4_r_blocks_count(sbi->s_es);
 #ifdef CONFIG_SMP
-	if (free_blocks - root_blocks < FBC_BATCH)
+	if (free_blocks - (nblocks + root_blocks) < FBC_BATCH)
 		free_blocks =
 			percpu_counter_sum_and_set(&sbi->s_freeblocks_counter);
 #endif
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 1c289c1..f825470 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1543,7 +1543,14 @@ static int ext4_da_reserve_space(struct inode *inode, int nrblocks)
 	}
 	/* reduce fs free blocks counter */
 	percpu_counter_sub(&sbi->s_freeblocks_counter, total);

  reply	other threads:[~2008-08-20 10:46 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-20  5:43 ENOSPC returned during writepages Aneesh Kumar K.V
2008-08-20 10:46 ` Aneesh Kumar K.V [this message]
2008-08-20 11:53   ` Theodore Tso
2008-08-20 18:27     ` Aneesh Kumar K.V
2008-08-20 21:35       ` Mingming Cao
2008-08-21 15:15         ` Aneesh Kumar K.V
2008-08-20 19:25     ` Andreas Dilger
2008-08-20 19:34       ` Theodore Tso
2008-08-20 20:56     ` Mingming Cao
2008-08-20 21:55       ` Theodore Tso
2008-08-20 22:02         ` Mingming Cao
2008-08-20 23:22       ` Mingming Cao
2008-08-20 23:42         ` Andreas Dilger
2008-08-20 23:58           ` Mingming Cao
2008-08-21  1:44             ` Andreas Dilger
2008-08-20 21:55     ` Mingming Cao
2008-08-21 15:18       ` Aneesh Kumar K.V
2008-08-21 15:35         ` Theodore Tso
2008-08-21 17:17           ` Mingming Cao
2008-08-23 11:12         ` Andreas Dilger
2008-08-21 15:12     ` Aneesh Kumar K.V
2008-08-21 16:56       ` Mingming Cao
2008-08-20 21:58 ` Mingming Cao
2008-08-21 15:09   ` Aneesh Kumar K.V
2008-08-21  5:06 ` Eric Sandeen
2008-08-21 16:45 ` Aneesh Kumar K.V
2008-08-21 17:07   ` Mingming Cao
2008-08-21 17:31     ` Aneesh Kumar K.V
2008-08-21 18:06       ` 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=20080820104644.GA11267@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