Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp90549imn; Wed, 27 Jul 2022 00:01:51 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tSqbfEuVkC7hrjw3AYHQMfxCG+L8UHk9GUChnpTEX/ofTdsKEi4BVwy8J3gqNgcQWgNDsv X-Received: by 2002:a17:90b:3ec1:b0:1f1:edcf:dd2b with SMTP id rm1-20020a17090b3ec100b001f1edcfdd2bmr3029703pjb.156.1658905311217; Wed, 27 Jul 2022 00:01:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658905311; cv=none; d=google.com; s=arc-20160816; b=F7d0/P1F/VnowJrVUOM0hbj6+NOFP2doHxuhtyDXjr+CDGy9PXpfeFHzMY+fg/O3U3 33IXE2sUbmaxd+BMzpNrvFw+rqZ74WVMNOz+dMXb815+HSDTU1YzGZXYwgl1cBnTfqPc NeLrUor4/8F+paTzzf+WtKhpytxk3C6OvRwcutbjoZpBrvPaiAM+tq7D92ZvteLDq/B1 VaixicRCmgVVxyIwB2vW910NqG3+HOELMcYp9jew1QNKfg4odjqqXO7k+tq2UebRFpca Ji2/Ixors0xxvQvRz9jpqbmu3YHsBMLniqlEyQzaltaFCDzZikOarpDxb3O6/Febn/at SxGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=o4fSbG+YWOWglpO9dEdqpAF1mqKjq1ryldnc2HbtTvA=; b=QPiVQ+CfaLznCza3Ogygr+pW0xs+RGgKw6yerR2cXMgDIYxTkb8RTMrO0owd7pjOjm yAFdd7H5dqOt7cHFdxMXi26ffIdJlmcG+fwZbeCKZhhf1xfYu/WeaDXTKrUq+9cjbgLd 2C/vc47YfLY/L8m1P9HABnytf0Yw4as3daMkaGIo2IigCEz38hAS+aNz85ZdNoRLH1Z8 36j320TmV6j6UR4e40Gh84eKLMaIZ1kt52/WzHG2jZ26kJVEyvL96aMfQ0PC4Qw3x5T1 VqU9mh+Roa62yhzJU9CM6ry44EO1RahQUyPkBJQWMu+/GAtjveszUWCGDdAbQVG1yAUo Xc1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i4-20020a17090ad34400b001f27725711dsi1298843pjx.58.2022.07.27.00.01.24; Wed, 27 Jul 2022 00:01:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229764AbiG0G75 (ORCPT + 99 others); Wed, 27 Jul 2022 02:59:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230186AbiG0G7n (ORCPT ); Wed, 27 Jul 2022 02:59:43 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 847763CBC6; Tue, 26 Jul 2022 23:59:42 -0700 (PDT) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Lt4NZ5JYMzmVBC; Wed, 27 Jul 2022 14:57:50 +0800 (CST) Received: from kwepemm600010.china.huawei.com (7.193.23.86) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 27 Jul 2022 14:59:37 +0800 Received: from huawei.com (10.175.127.227) by kwepemm600010.china.huawei.com (7.193.23.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 27 Jul 2022 14:59:36 +0800 From: Sun Ke To: CC: , , Subject: [PATCH v5] ext4: resize an ext4 which resize_inode feature is disabled but has reserved GDT blocks. Date: Wed, 27 Jul 2022 15:11:40 +0800 Message-ID: <20220727071140.3886185-1-sunke32@huawei.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600010.china.huawei.com (7.193.23.86) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org A regression test for b55c3cd102a6 ("ext4: add reserved GDT blocks check"). Make sure there's not kernel crash, if resize an ext4 which resize_inode feature is disabled but has reserved GDT blocks. Signed-off-by: Sun Ke --- tests/ext4/057 | 41 +++++++++++++++++++++++++++++++++++++++++ tests/ext4/057.out | 2 ++ 2 files changed, 43 insertions(+) create mode 100755 tests/ext4/057 create mode 100644 tests/ext4/057.out diff --git a/tests/ext4/057 b/tests/ext4/057 new file mode 100755 index 00000000..969da377 --- /dev/null +++ b/tests/ext4/057 @@ -0,0 +1,41 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 HUAWEI. All Rights Reserved. +# +# FS QA Test 057 +# +# A regression test for b55c3cd102a6 ("ext4: add reserved GDT blocks check"). +# Make sure there's not kernel crash, if resize an ext4 which resize_inode +# feature is disabled but has reserved GDT blocks. +# +. ./common/preamble +_begin_fstest auto resize quick + +# real QA test starts here +_supported_fs ext4 +_fixed_by_kernel_commit b55c3cd102a6 \ + "ext4: add reserved GDT blocks check" + +_require_command "$RESIZE2FS_PROG" resize2fs +_require_command "$DEBUGFS_PROG" debugfs +_require_scratch_size_nocheck $((1024 * 1024)) + +# Initalize a 512M ext4 fs with resize_inode feature disabled +dev_size=$((512 * 1024 * 1024)) +MKFS_OPTIONS="-O ^resize_inode $MKFS_OPTIONS" _scratch_mkfs_sized $dev_size \ + >>$seqres.full 2>&1 || _fail "mkfs failed" + +# Force some reserved GDT blocks to trigger the bug +$DEBUGFS_PROG -w -R "set_super_value s_reserved_gdt_blocks 100" $SCRATCH_DEV \ + >>$seqres.full 2>&1 +$DEBUGFS_PROG -R "show_super_stats -h" $SCRATCH_DEV 2>/dev/null | \ + grep "Reserved GDT blocks" + +_scratch_mount + +# Expect no crash from this resize operation +$RESIZE2FS_PROG $SCRATCH_DEV 1G >> $seqres.full 2>&1 + +# success, all done +status=0 +exit diff --git a/tests/ext4/057.out b/tests/ext4/057.out new file mode 100644 index 00000000..99423e16 --- /dev/null +++ b/tests/ext4/057.out @@ -0,0 +1,2 @@ +QA output created by 057 +Reserved GDT blocks: 100 -- 2.13.6