From patchwork Mon Jul 22 01:23:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11051327 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 536501398 for ; Mon, 22 Jul 2019 01:25:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3DF2426E4A for ; Mon, 22 Jul 2019 01:25:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 321FC284AA; Mon, 22 Jul 2019 01:25:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8426626E4A for ; Mon, 22 Jul 2019 01:25:16 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id D645121FE0A; Sun, 21 Jul 2019 18:24:48 -0700 (PDT) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 6471D21FD25 for ; Sun, 21 Jul 2019 18:24:02 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id EABDBB86; Sun, 21 Jul 2019 21:23:55 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id E8160B5; Sun, 21 Jul 2019 21:23:55 -0400 (EDT) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown , Shaun Tancheff , Li Dongyang , Artem Blagodarenko , Yang Sheng Date: Sun, 21 Jul 2019 21:23:44 -0400 Message-Id: <1563758631-29550-16-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1563758631-29550-1-git-send-email-jsimmons@infradead.org> References: <1563758631-29550-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 15/22] ext4: remove bitmap corruption warnings X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);