From: James Simmons <jsimmons@infradead.org>
To: lustre-devel@lists.lustre.org
Subject: [lustre-devel] [PATCH 15/22] ext4: remove bitmap corruption warnings
Date: Sun, 21 Jul 2019 21:23:44 -0400 [thread overview]
Message-ID: <1563758631-29550-16-git-send-email-jsimmons@infradead.org> (raw)
In-Reply-To: <1563758631-29550-1-git-send-email-jsimmons@infradead.org>
Since we could skip corrupt block groups, this patch
use ext4_warning() intead of ext4_error() to make FS not
mount RO in default.
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
fs/ext4/balloc.c | 10 ++++-----
fs/ext4/ialloc.c | 6 ++---
fs/ext4/mballoc.c | 66 +++++++++++++++++++++++--------------------------------
3 files changed, 35 insertions(+), 47 deletions(-)
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index bca75c1..aff3981 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -374,7 +374,7 @@ static int ext4_validate_block_bitmap(struct super_block *sb,
if (unlikely(!ext4_block_bitmap_csum_verify(sb, block_group,
desc, bh))) {
ext4_unlock_group(sb, block_group);
- ext4_error(sb, "bg %u: bad block bitmap checksum", block_group);
+ ext4_warning(sb, "bg %u: bad block bitmap checksum", block_group);
ext4_mark_group_bitmap_corrupted(sb, block_group,
EXT4_GROUP_INFO_BBITMAP_CORRUPT);
return -EFSBADCRC;
@@ -382,8 +382,8 @@ static int ext4_validate_block_bitmap(struct super_block *sb,
blk = ext4_valid_block_bitmap(sb, desc, block_group, bh);
if (unlikely(blk != 0)) {
ext4_unlock_group(sb, block_group);
- ext4_error(sb, "bg %u: block %llu: invalid block bitmap",
- block_group, blk);
+ ext4_warning(sb, "bg %u: block %llu: invalid block bitmap",
+ block_group, blk);
ext4_mark_group_bitmap_corrupted(sb, block_group,
EXT4_GROUP_INFO_BBITMAP_CORRUPT);
return -EFSCORRUPTED;
@@ -459,8 +459,8 @@ struct buffer_head *
ext4_unlock_group(sb, block_group);
unlock_buffer(bh);
if (err) {
- ext4_error(sb, "Failed to init block bitmap for group "
- "%u: %d", block_group, err);
+ ext4_warning(sb, "Failed to init block bitmap for group "
+ "%u: %d", block_group, err);
goto out;
}
goto verify;
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 68d41e6..a72fe63 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -96,8 +96,8 @@ static int ext4_validate_inode_bitmap(struct super_block *sb,
if (!ext4_inode_bitmap_csum_verify(sb, block_group, desc, bh,
EXT4_INODES_PER_GROUP(sb) / 8)) {
ext4_unlock_group(sb, block_group);
- ext4_error(sb, "Corrupt inode bitmap - block_group = %u, "
- "inode_bitmap = %llu", block_group, blk);
+ ext4_warning(sb, "Corrupt inode bitmap - block_group = %u, "
+ "inode_bitmap = %llu", block_group, blk);
ext4_mark_group_bitmap_corrupted(sb, block_group,
EXT4_GROUP_INFO_IBITMAP_CORRUPT);
return -EFSBADCRC;
@@ -346,7 +346,7 @@ void ext4_free_inode(handle_t *handle, struct inode *inode)
if (!fatal)
fatal = err;
} else {
- ext4_error(sb, "bit already cleared for inode %lu", ino);
+ ext4_warning(sb, "bit already cleared for inode %lu", ino);
ext4_mark_group_bitmap_corrupted(sb, block_group,
EXT4_GROUP_INFO_IBITMAP_CORRUPT);
}
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 463fba6..82398b0 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -741,10 +741,15 @@ int ext4_mb_generate_buddy(struct super_block *sb,
grp->bb_fragments = fragments;
if (free != grp->bb_free) {
- ext4_grp_locked_error(sb, group, 0, 0,
- "block bitmap and bg descriptor "
- "inconsistent: %u vs %u free clusters",
- free, grp->bb_free);
+ struct ext4_group_desc *gdp;
+
+ gdp = ext4_get_group_desc(sb, group, NULL);
+ ext4_warning(sb, "group %lu: block bitmap and bg descriptor "
+ "inconsistent: %u vs %u free clusters "
+ "%u in gd, %lu pa's",
+ (long unsigned int)group, free, grp->bb_free,
+ ext4_free_group_clusters(sb, gdp),
+ grp->bb_prealloc_nr);
/*
* If we intend to continue, we consider group descriptor
* corrupt and update bb_free using bitmap value
@@ -1106,7 +1111,7 @@ int ext4_mb_init_group(struct super_block *sb, ext4_group_t group, gfp_t gfp)
int block;
int pnum;
int poff;
- struct page *page;
+ struct page *page = NULL;
int ret;
struct ext4_group_info *grp;
struct ext4_sb_info *sbi = EXT4_SB(sb);
@@ -1132,7 +1137,7 @@ int ext4_mb_init_group(struct super_block *sb, ext4_group_t group, gfp_t gfp)
*/
ret = ext4_mb_init_group(sb, group, gfp);
if (ret)
- return ret;
+ goto err;
}
/*
@@ -1235,6 +1240,7 @@ int ext4_mb_init_group(struct super_block *sb, ext4_group_t group, gfp_t gfp)
put_page(e4b->bd_buddy_page);
e4b->bd_buddy = NULL;
e4b->bd_bitmap = NULL;
+ ext4_warning(sb, "Error loading buddy information for %u", group);
return ret;
}
@@ -3631,8 +3637,10 @@ int ext4_mb_check_ondisk_bitmap(struct super_block *sb, void *bitmap,
}
if (free != free_in_gdp) {
- ext4_error(sb, "on-disk bitmap for group %d corrupted: %u blocks free in bitmap, %u - in gd\n",
- group, free, free_in_gdp);
+ ext4_warning(sb, "on-disk bitmap for group %d corrupted: %u blocks free in bitmap, %u - in gd\n",
+ group, free, free_in_gdp);
+ ext4_mark_group_bitmap_corrupted(sb, group,
+ EXT4_GROUP_INFO_BBITMAP_CORRUPT);
return -EIO;
}
return 0;
@@ -4015,14 +4023,6 @@ static int ext4_mb_new_preallocation(struct ext4_allocation_context *ac)
* otherwise maybe leave some free blocks unavailable, no need to BUG.
*/
if ((free > pa->pa_free && !pa->pa_error) || (free < pa->pa_free)) {
- ext4_error(sb, "pa free mismatch: [pa %p] "
- "[phy %lu] [logic %lu] [len %u] [free %u] "
- "[error %u] [inode %lu] [freed %u]", pa,
- (unsigned long)pa->pa_pstart,
- (unsigned long)pa->pa_lstart,
- (unsigned)pa->pa_len, (unsigned)pa->pa_free,
- (unsigned)pa->pa_error, pa->pa_inode->i_ino,
- free);
ext4_grp_locked_error(sb, group, 0, 0, "free %u, pa_free %u",
free, pa->pa_free);
/*
@@ -4086,15 +4086,11 @@ static int ext4_mb_new_preallocation(struct ext4_allocation_context *ac)
bitmap_bh = ext4_read_block_bitmap(sb, group);
if (IS_ERR(bitmap_bh)) {
err = PTR_ERR(bitmap_bh);
- ext4_error(sb, "Error %d reading block bitmap for %u",
- err, group);
return 0;
}
err = ext4_mb_load_buddy(sb, group, &e4b);
if (err) {
- ext4_warning(sb, "Error %d loading buddy information for %u",
- err, group);
put_bh(bitmap_bh);
return 0;
}
@@ -4255,17 +4251,12 @@ void ext4_discard_preallocations(struct inode *inode)
err = ext4_mb_load_buddy_gfp(sb, group, &e4b,
GFP_NOFS|__GFP_NOFAIL);
- if (err) {
- ext4_error(sb, "Error %d loading buddy information for %u",
- err, group);
+ if (err)
return;
- }
bitmap_bh = ext4_read_block_bitmap(sb, group);
if (IS_ERR(bitmap_bh)) {
err = PTR_ERR(bitmap_bh);
- ext4_error(sb, "Error %d reading block bitmap for %u",
- err, group);
ext4_mb_unload_buddy(&e4b);
continue;
}
@@ -4527,11 +4518,8 @@ static void ext4_mb_group_or_file(struct ext4_allocation_context *ac)
group = ext4_get_group_number(sb, pa->pa_pstart);
err = ext4_mb_load_buddy_gfp(sb, group, &e4b,
GFP_NOFS|__GFP_NOFAIL);
- if (err) {
- ext4_error(sb, "Error %d loading buddy information for %u",
- err, group);
+ if (err)
continue;
- }
ext4_lock_group(sb, group);
list_del(&pa->pa_group_list);
ext4_get_group_info(sb, group)->bb_prealloc_nr--;
@@ -4785,7 +4773,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
* not revert pa_free back, just mark pa_error
*/
pa->pa_error++;
- ext4_error(sb,
+ ext4_warning(sb,
"Updating bitmap error: [err %d] "
"[pa %p] [phy %lu] [logic %lu] "
"[len %u] [free %u] [error %u] "
@@ -4796,6 +4784,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
(unsigned)pa->pa_free,
(unsigned)pa->pa_error,
pa->pa_inode ? pa->pa_inode->i_ino : 0);
+ ext4_mark_group_bitmap_corrupted(sb, 0, 0);
}
}
ext4_mb_release_context(ac);
@@ -5081,7 +5070,7 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode,
err = ext4_mb_load_buddy_gfp(sb, block_group, &e4b,
GFP_NOFS|__GFP_NOFAIL);
if (err)
- goto error_return;
+ goto error_brelse;
/*
* We need to make sure we don't reuse the freed block until after the
@@ -5171,8 +5160,9 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode,
goto do_more;
}
error_return:
- brelse(bitmap_bh);
ext4_std_error(sb, err);
+error_brelse:
+ brelse(bitmap_bh);
return;
}
@@ -5272,7 +5262,7 @@ int ext4_group_add_blocks(handle_t *handle, struct super_block *sb,
err = ext4_mb_load_buddy(sb, block_group, &e4b);
if (err)
- goto error_return;
+ goto error_brelse;
/*
* need to update group_info->bb_free and bitmap
@@ -5310,8 +5300,9 @@ int ext4_group_add_blocks(handle_t *handle, struct super_block *sb,
err = ret;
error_return:
- brelse(bitmap_bh);
ext4_std_error(sb, err);
+error_brelse:
+ brelse(bitmap_bh);
return err;
}
@@ -5386,11 +5377,8 @@ static int ext4_trim_extent(struct super_block *sb, int start, int count,
trace_ext4_trim_all_free(sb, group, start, max);
ret = ext4_mb_load_buddy(sb, group, &e4b);
- if (ret) {
- ext4_warning(sb, "Error %d loading buddy information for %u",
- ret, group);
+ if (ret)
return ret;
- }
bitmap = e4b.bd_bitmap;
ext4_lock_group(sb, group);
--
1.8.3.1
next prev parent reply other threads:[~2019-07-22 1:23 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-22 1:23 [lustre-devel] [PATCH 00/22] [RFC] ldiskfs patches against 5.2-rc2+ James Simmons
2019-07-22 1:23 ` [lustre-devel] [PATCH 01/22] ext4: add i_fs_version James Simmons
2019-07-22 4:13 ` NeilBrown
2019-07-23 0:07 ` James Simmons
2019-07-31 22:03 ` Andreas Dilger
2019-07-22 1:23 ` [lustre-devel] [PATCH 02/22] ext4: use d_find_alias() in ext4_lookup James Simmons
2019-07-22 4:16 ` NeilBrown
2019-07-22 1:23 ` [lustre-devel] [PATCH 03/22] ext4: prealloc table optimization James Simmons
2019-07-22 4:29 ` NeilBrown
2019-08-05 7:07 ` Artem Blagodarenko
2019-07-22 1:23 ` [lustre-devel] [PATCH 04/22] ext4: export inode management James Simmons
2019-07-22 4:34 ` NeilBrown
2019-07-22 7:16 ` Oleg Drokin
2019-07-22 1:23 ` [lustre-devel] [PATCH 05/22] ext4: various misc changes James Simmons
2019-07-22 1:23 ` [lustre-devel] [PATCH 06/22] ext4: add extra checks for mballoc James Simmons
2019-07-22 4:37 ` NeilBrown
2019-07-22 1:23 ` [lustre-devel] [PATCH 07/22] ext4: update .. for hash indexed directory James Simmons
2019-07-22 4:45 ` NeilBrown
2019-07-22 1:23 ` [lustre-devel] [PATCH 08/22] ext4: kill off struct dx_root James Simmons
2019-07-22 4:52 ` NeilBrown
2019-07-23 2:07 ` Andreas Dilger
2019-08-05 7:31 ` Artem Blagodarenko
2019-07-22 1:23 ` [lustre-devel] [PATCH 09/22] ext4: fix mballoc pa free mismatch James Simmons
2019-07-22 4:56 ` NeilBrown
2019-07-22 1:23 ` [lustre-devel] [PATCH 10/22] ext4: add data in dentry feature James Simmons
2019-07-22 1:23 ` [lustre-devel] [PATCH 11/22] ext4: over ride current_time James Simmons
2019-07-22 5:06 ` NeilBrown
2019-07-22 1:23 ` [lustre-devel] [PATCH 12/22] ext4: add htree lock implementation James Simmons
2019-07-22 5:10 ` NeilBrown
2019-07-22 1:23 ` [lustre-devel] [PATCH 13/22] ext4: Add a proc interface for max_dir_size James Simmons
2019-07-22 5:14 ` NeilBrown
2019-07-22 1:23 ` [lustre-devel] [PATCH 14/22] ext4: remove inode_lock handling James Simmons
2019-07-22 5:16 ` NeilBrown
2019-07-22 1:23 ` James Simmons [this message]
2019-07-22 5:18 ` [lustre-devel] [PATCH 15/22] ext4: remove bitmap corruption warnings NeilBrown
2019-07-22 1:23 ` [lustre-devel] [PATCH 16/22] ext4: add warning for directory htree growth James Simmons
2019-07-22 5:24 ` NeilBrown
2019-07-22 1:23 ` [lustre-devel] [PATCH 17/22] ext4: optimize ext4_journal_callback_add James Simmons
2019-07-22 5:27 ` NeilBrown
2019-07-23 2:01 ` Andreas Dilger
2019-07-22 1:23 ` [lustre-devel] [PATCH 18/22] ext4: attach jinode in writepages James Simmons
2019-07-22 1:23 ` [lustre-devel] [PATCH 19/22] ext4: don't check before replay James Simmons
2019-07-22 5:29 ` NeilBrown
[not found] ` <506765DD-0068-469E-ADA4-2C71B8B60114@cloudlinux.com>
2019-07-22 6:46 ` NeilBrown
2019-07-22 6:56 ` Oleg Drokin
2019-07-22 9:51 ` Alexey Lyashkov
2019-07-23 1:57 ` Andreas Dilger
2019-07-23 2:01 ` Oleg Drokin
2019-07-22 1:23 ` [lustre-devel] [PATCH 20/22] ext4: use GFP_NOFS in ext4_inode_attach_jinode James Simmons
2019-07-22 5:30 ` NeilBrown
2019-07-23 1:56 ` Andreas Dilger
2019-07-22 1:23 ` [lustre-devel] [PATCH 21/22] ext4: export ext4_orphan_add James Simmons
2019-07-22 1:23 ` [lustre-devel] [PATCH 22/22] ext4: export mb stream allocator variables James Simmons
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=1563758631-29550-16-git-send-email-jsimmons@infradead.org \
--to=jsimmons@infradead.org \
--cc=lustre-devel@lists.lustre.org \
/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;
as well as URLs for NNTP newsgroup(s).