Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp343347pxk; Thu, 24 Sep 2020 07:02:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWU4tN4Jm5Hz5qT4Sh018vF0A9MZpxW2ec9dTqsH4JJttSOfWiNPiRFp60h0Fqh0ahsi6o X-Received: by 2002:aa7:d78f:: with SMTP id s15mr34855edq.322.1600956141508; Thu, 24 Sep 2020 07:02:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600956141; cv=none; d=google.com; s=arc-20160816; b=eDPlKuAKaO0azD3oUapuxrQjALC4WF6qdCNljrrf0JPZF57GlDHXFdDyUdx0AWT5F0 yAFOFJixBmDgnfQMjsbhqPRK4iPeWb44P9pt9CBWIRHkJimUExtHwnVCO+MPwvUFG3V/ vq9S1SLy9vRxZXdLOe8V/7ZFWwGC6GFJ54Vfx1ZVlhA0/hVoaFhuXVia1btkQaVIFJPI aYGWIrOtiaRDdsjLmbDW2pI3qKeH/jPPIq++DSI0GjJm12aOUJfuosP5S90+XYdE32Ar D9TLoHYImavknEnIxGMgIe8fWfJIVss+opEtHkWIT2NQniUjjq9hx8M/vHwTbqQzBi+m jJJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=pr5YjwppHbo3mJ1Tcoygbvqrxeo9yAZLBHd+M2PjDMc=; b=RTMykB1o76upc5MSkvAsthqb714Of4Rubh8JqnMk/mZQ38r2+a/T+OJnsMWReU9Y55 1BJNx8vwQAM0YZnGNoqSAFlODUHnJZ/L1bRpLgE3xEco63ARh2FkOCQfUKEu+p/2ruBM yUM1BZlLvwDkTkABl3wx8R0KBs+g/T+Qy7lIZTUWppgRXKPxGLqySmmSF/fqMNuxef+G /n/PF/HXLZTaJfTQgAfkUuZ/s2ilqAgTzu6CUZ3IASaFPpXVWXkJoDfuC50Uv+8+L6bF yOyQTUc8vyJOqUz+aKuygR3dlk+n2Mlr5V6g3kJumPNT2Ufmwn2tjfeiBzUmwwnsAyUb xfvQ== 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 g13si2188645edk.510.2020.09.24.07.01.44; Thu, 24 Sep 2020 07:02:21 -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 S1728301AbgIXOAk (ORCPT + 99 others); Thu, 24 Sep 2020 10:00:40 -0400 Received: from mx2.suse.de ([195.135.220.15]:45888 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728104AbgIXOAk (ORCPT ); Thu, 24 Sep 2020 10:00:40 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 77003B12A; Thu, 24 Sep 2020 14:00:38 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 32A6A1E12ED; Thu, 24 Sep 2020 10:06:13 +0200 (CEST) Date: Thu, 24 Sep 2020 10:06:13 +0200 From: Jan Kara To: Zhang Xiaoxu Cc: yi.zhang@huawei.com, tytso@mit.edu, jack@suse.cz, linux-ext4@vger.kernel.org, adilger.kernel@dilger.ca Subject: Re: [PATCH] ext4: Fix bdev write error check failed when mount fs with ro Message-ID: <20200924080613.GC27019@quack2.suse.cz> References: <20200924011149.1624846-1-zhangxiaoxu5@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200924011149.1624846-1-zhangxiaoxu5@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Wed 23-09-20 21:11:49, Zhang Xiaoxu wrote: > 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 Thanks for the patch! Good catch! I just think you should now remove the errseq_check_and_advance() call in ext4_remount() because it isn't needed anymore. Honza > 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 > -- Jan Kara SUSE Labs, CR