Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp738797pxk; Thu, 24 Sep 2020 18:02:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQef4pr8zf2ZtEZODwJCyxWP4QIrmX6M5qPODaJqC58oVbEc6jdP9UKiIzNqX/6FWPJ2IM X-Received: by 2002:a17:906:b7c1:: with SMTP id fy1mr329136ejb.342.1600995750470; Thu, 24 Sep 2020 18:02:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600995750; cv=none; d=google.com; s=arc-20160816; b=YLUKDGZLq0PLFrZEH/NlB0+Y35dgdWLI2dPhd7ltLyctj5sbeSY4N38tHiQhYloUOT xWc/NokNEzV+j56DovUWN6bAYMr9EXdLzU2Mlj1l3EOtt/lBauqXdPTXvZFThV4WTHgZ zwnS0QwRE5p0AVTP1QRifQAx/uqJ0y2BkkshIrs1OKhEBf2IfLNHTjCbU0Qd9xNU9NVv wNopRmKf4p3QiitWiA1llH1J/fnPqucJ0I50ahlWK3gYH0UwXnhdkipgvzYXRNr1drvj bXdrCM3AXiRDqC0Yppu1MgkIwYxzWtycpLzJKGPQn3hphwMvlmF23nmX+p97x6xSjnaD EvLw== 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=ddr6vpVZGY47g6bJ5uLewDHHVGYTnvMGQsD3mhKNdb0=; b=uijnoht0IzgeJv7bbpoPiJV0DDWL6cKJqv5dv7wfan6ytdPxgPFO1/atlSyqmv+2Yt JRIWVAFSG5r3Zk75hq7ZPea+BKIIcW0I0OwQMRZd0ZvXYTi6wvu43497Iup21knnb6fQ pb87QGP3o8uYL4qldsFc/nqi/Z1tda1LYPWWvYh0q3bwUf4kCxsgQEBv22tRb2mD6Rs0 4cSCrnLqoAdyMLdngR4rU96CZ+KXLv/bvIm8a1Wem9mBO5wJorTcwdmebAcs4PcjR67z O6ZjH72oF1Ihsgthf/negi1+CgtYMWupcvIgF6ziGdZDPOyAKVSnCAThDB9VHCaGZJyw xpUA== 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 m26si832518ejc.349.2020.09.24.18.01.55; Thu, 24 Sep 2020 18:02:30 -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 S1726826AbgIYBBp (ORCPT + 99 others); Thu, 24 Sep 2020 21:01:45 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:52682 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726703AbgIYBBp (ORCPT ); Thu, 24 Sep 2020 21:01:45 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 3C48F31017809A2C5B21; Fri, 25 Sep 2020 09:01:43 +0800 (CST) Received: from localhost.localdomain (10.175.101.6) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.487.0; Fri, 25 Sep 2020 09:01:37 +0800 From: Zhang Xiaoxu To: , , , CC: Subject: [PATCH v2] ext4: Fix bdev write error check failed when mount fs with ro Date: Thu, 24 Sep 2020 21:01:42 -0400 Message-ID: <20200925010142.3711176-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 | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index ea425b49b345..0303e6e17190 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); @@ -5707,14 +5706,6 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) goto restore_opts; } - /* - * Update the original bdev mapping's wb_err value - * which could be used to detect the metadata async - * write error. - */ - errseq_check_and_advance(&sb->s_bdev->bd_inode->i_mapping->wb_err, - &sbi->s_bdev_wb_err); - /* * Mounting a RDONLY partition read-write, so reread * and store the current valid flag. (It may have -- 2.25.4