* [PATCH 1/2 v2] ext4: check free block counters in ext4_mb_find_by_goal
@ 2012-09-06 13:16 Yongqiang Yang
2012-09-06 13:16 ` [PATCH 2/2 v2] ext4: check free inode count before allocaing an inode Yongqiang Yang
2012-09-24 3:11 ` [PATCH 1/2 v2] ext4: check free block counters in ext4_mb_find_by_goal Theodore Ts'o
0 siblings, 2 replies; 4+ messages in thread
From: Yongqiang Yang @ 2012-09-06 13:16 UTC (permalink / raw)
To: linux-ext4; +Cc: tytso, Yongqiang Yang
Free block counters should be checked before doing allocation.
Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
---
fs/ext4/mballoc.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 6873571..5d4c21a 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -1659,10 +1659,13 @@ int ext4_mb_find_by_goal(struct ext4_allocation_context *ac,
int max;
int err;
struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb);
+ struct ext4_group_info *grp = ext4_get_group_info(ac->ac_sb, group);
struct ext4_free_extent ex;
if (!(ac->ac_flags & EXT4_MB_HINT_TRY_GOAL))
return 0;
+ if (grp->bb_free == 0)
+ return 0;
err = ext4_mb_load_buddy(ac->ac_sb, group, e4b);
if (err)
--
1.7.5.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2 v2] ext4: check free inode count before allocaing an inode
2012-09-06 13:16 [PATCH 1/2 v2] ext4: check free block counters in ext4_mb_find_by_goal Yongqiang Yang
@ 2012-09-06 13:16 ` Yongqiang Yang
2012-09-24 3:17 ` Theodore Ts'o
2012-09-24 3:11 ` [PATCH 1/2 v2] ext4: check free block counters in ext4_mb_find_by_goal Theodore Ts'o
1 sibling, 1 reply; 4+ messages in thread
From: Yongqiang Yang @ 2012-09-06 13:16 UTC (permalink / raw)
To: linux-ext4; +Cc: tytso, Yongqiang Yang
Recnetly, I ecountered some corrupted filesystems in which some
groups' free inode counts were 65535, it seemed that free inode
count was overflow. This patch teaches ext4 to check free inode
count before allocaing an inode.
Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
---
fs/ext4/ialloc.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 26154b8..fa36372 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -697,6 +697,15 @@ got_group:
if (!gdp)
goto fail;
+ /*
+ * Check free inodes count before loading bitmap.
+ */
+ if (ext4_free_inodes_count(sb, gdp) == 0) {
+ if (++group == ngroups)
+ group = 0;
+ continue;
+ }
+
brelse(inode_bitmap_bh);
inode_bitmap_bh = ext4_read_inode_bitmap(sb, group);
if (!inode_bitmap_bh)
--
1.7.5.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2 v2] ext4: check free block counters in ext4_mb_find_by_goal
2012-09-06 13:16 [PATCH 1/2 v2] ext4: check free block counters in ext4_mb_find_by_goal Yongqiang Yang
2012-09-06 13:16 ` [PATCH 2/2 v2] ext4: check free inode count before allocaing an inode Yongqiang Yang
@ 2012-09-24 3:11 ` Theodore Ts'o
1 sibling, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2012-09-24 3:11 UTC (permalink / raw)
To: Yongqiang Yang; +Cc: linux-ext4
On Thu, Sep 06, 2012 at 09:16:54PM +0800, Yongqiang Yang wrote:
> Free block counters should be checked before doing allocation.
>
> Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
Thanks, applied.
- Ted
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2 v2] ext4: check free inode count before allocaing an inode
2012-09-06 13:16 ` [PATCH 2/2 v2] ext4: check free inode count before allocaing an inode Yongqiang Yang
@ 2012-09-24 3:17 ` Theodore Ts'o
0 siblings, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2012-09-24 3:17 UTC (permalink / raw)
To: Yongqiang Yang; +Cc: linux-ext4
On Thu, Sep 06, 2012 at 09:16:55PM +0800, Yongqiang Yang wrote:
> Recnetly, I ecountered some corrupted filesystems in which some
> groups' free inode counts were 65535, it seemed that free inode
> count was overflow. This patch teaches ext4 to check free inode
> count before allocaing an inode.
>
> Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
Thanks, applied.
- Ted
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-09-25 18:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-06 13:16 [PATCH 1/2 v2] ext4: check free block counters in ext4_mb_find_by_goal Yongqiang Yang
2012-09-06 13:16 ` [PATCH 2/2 v2] ext4: check free inode count before allocaing an inode Yongqiang Yang
2012-09-24 3:17 ` Theodore Ts'o
2012-09-24 3:11 ` [PATCH 1/2 v2] ext4: check free block counters in ext4_mb_find_by_goal Theodore Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).