Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp830087pxk; Wed, 23 Sep 2020 18:12:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsf2C5RCF2YmgrvwrKjfYU6K1t4vSye/nqD/qtd1F7r7Fa4uEXf3xD+kIg6X2jmvwl9sZS X-Received: by 2002:a17:906:dbe6:: with SMTP id yd6mr2202274ejb.120.1600909957651; Wed, 23 Sep 2020 18:12:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600909957; cv=none; d=google.com; s=arc-20160816; b=yq0bGETZeyIL+lQtqyHZfuD1oBzL0ak3LpnUkwThGBpUICiSno5P6+7bnlIlfR/A0W VdyfamoncsQylzOlX0ni0aUIFQgd91Wr/xwVfX0SXSMeXxLpjxNNfvIwf4ISB3H2fyYE orc+KHsuP4FnReHzmGDCPheln6TuvP4/8vVhdeZKpP+3ETfGe+NuBcmAqg+kNN+265NC PSEZE+8LV3bJRRw1Zt9wZUEX90G2vO9SF93KlZcZE56UrkO3Mmjw+0684RIsXPx8VqsI eUfM2YxZxXbdIaNp+wTXsEvTqBNF4b4qhMwsxX5e6nuGb6dk9HF1CxMKthnG8L+pdWRm kHdA== 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=3I1goyqRFcneEkpn7tPWzJQnwdXNAADZAeeVTbRgbfQ=; b=JLgUUOZlqr9K+KNNQquLOLOHpwxck6QRKUvflTKgjUxfMp5/enFTc0qBp84hpcZI8P 92dCDVChFzqfwxH5cbAMhyiBVMrtcj0ENWeoawc1sheh6lgPOgvZsU6F/vZJPRK56573 YaaAn9cMQjZWtkBSCny7BN4ku62HeS01B9nrQSUZppqPOwPu+P3NceJVT2uuWaM8KxNY hXKBVNacBzEZCZMxApRVgS7qkeA/HdGoI1/IO8igmSJqtM+onUtXVg7J0GKPvD60V63d +8EGECL+yvMLaNo+pV7+eFTnHRq/EctW5UMP/sE1t1aHQNrgcw8/ltafVc0UmmLC0pU7 +orw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ot12si943416ejb.692.2020.09.23.18.12.06; Wed, 23 Sep 2020 18:12:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726621AbgIXBMD (ORCPT + 99 others); Wed, 23 Sep 2020 21:12:03 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:14217 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726599AbgIXBMD (ORCPT ); Wed, 23 Sep 2020 21:12:03 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id BC101B21791100E8AB3E; Thu, 24 Sep 2020 09:12:00 +0800 (CST) Received: from localhost.localdomain (10.175.101.6) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.487.0; Thu, 24 Sep 2020 09:11:50 +0800 From: Zhang Xiaoxu To: , , , CC: Subject: [PATCH] ext4: Fix bdev write error check failed when mount fs with ro Date: Wed, 23 Sep 2020 21:11:49 -0400 Message-ID: <20200924011149.1624846-1-zhangxiaoxu5@huawei.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.101.6] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org If some errors has occurred on the device, and the orphan list not empty, then mount the device with 'ro', the bdev write error check will failed: ext4_check_bdev_write_error:193: comm mount: Error while async write back metadata Since the sbi->s_bdev_wb_err wouldn't be initialized when mount file system with 'ro', when clean up the orphan list and access the iloc buffer, bdev write error check will failed. So we should always initialize the sbi->s_bdev_wb_err even if mount the file system with 'ro'. Fixes: bc71726c7257 ("ext4: abort the filesystem if failed to async write metadata buffer") Signed-off-by: Zhang Xiaoxu --- fs/ext4/super.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index ea425b49b345..086439889869 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4814,9 +4814,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) * used to detect the metadata async write error. */ spin_lock_init(&sbi->s_bdev_wb_lock); - if (!sb_rdonly(sb)) - errseq_check_and_advance(&sb->s_bdev->bd_inode->i_mapping->wb_err, - &sbi->s_bdev_wb_err); + errseq_check_and_advance(&sb->s_bdev->bd_inode->i_mapping->wb_err, + &sbi->s_bdev_wb_err); sb->s_bdev->bd_super = sb; EXT4_SB(sb)->s_mount_state |= EXT4_ORPHAN_FS; ext4_orphan_cleanup(sb, es); -- 2.25.4