From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2334FC55189 for ; Wed, 22 Apr 2020 10:14:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EBBA120575 for ; Wed, 22 Apr 2020 10:14:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587550494; bh=g5K/VIFnX6n9H7X4MvMACtPUJaoWu7dijJCBbR+xAGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=fwfMpvDjxBGkG19Z0MmXFeMrn7K+hBNpXelOO97CM8FzP5BCtCj0dOuIYyW9S3Kak uLn+GCezj/RhJm8QVrJdsPnydCOXFibaITell6B1MkFqUKelBnbIPgow135wnvmBPi bzcUZUwNGDs9PvFuZSPC+zqcN2s+p66ZUJc+ElDw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729591AbgDVKOu (ORCPT ); Wed, 22 Apr 2020 06:14:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:49636 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729584AbgDVKOr (ORCPT ); Wed, 22 Apr 2020 06:14:47 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D227A20575; Wed, 22 Apr 2020 10:14:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587550487; bh=g5K/VIFnX6n9H7X4MvMACtPUJaoWu7dijJCBbR+xAGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dDddXJ4u6QJu/EE3KH3NZRtLwmjKVoYC0/aT1sSABud5qjHniYS908ejQNVKVekzV ISrj52ZkOt3sXTvWhTQVi3gfjAmwg6ELvANQFE9SGfIJLkRmHNEcbpJnvgSTy6IdqO nHTiEuCBhsIIwUuXMQ2Kefx+l6cbn/t5xTjBRy2Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ritesh Harjani , Eric Sandeen , Andreas Dilger , Theodore Tso , Sasha Levin Subject: [PATCH 4.19 36/64] ext4: do not commit super on read-only bdev Date: Wed, 22 Apr 2020 11:57:20 +0200 Message-Id: <20200422095019.367269935@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200422095008.799686511@linuxfoundation.org> References: <20200422095008.799686511@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Eric Sandeen [ Upstream commit c96e2b8564adfb8ac14469ebc51ddc1bfecb3ae2 ] Under some circumstances we may encounter a filesystem error on a read-only block device, and if we try to save the error info to the superblock and commit it, we'll wind up with a noisy error and backtrace, i.e.: [ 3337.146838] EXT4-fs error (device pmem1p2): ext4_get_journal_inode:4634: comm mount: inode #0: comm mount: iget: illegal inode # ------------[ cut here ]------------ generic_make_request: Trying to write to read-only block-device pmem1p2 (partno 2) WARNING: CPU: 107 PID: 115347 at block/blk-core.c:788 generic_make_request_checks+0x6b4/0x7d0 ... To avoid this, commit the error info in the superblock only if the block device is writable. Reported-by: Ritesh Harjani Signed-off-by: Eric Sandeen Reviewed-by: Andreas Dilger Link: https://lore.kernel.org/r/4b6e774d-cc00-3469-7abb-108eb151071a@sandeen.net Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin --- fs/ext4/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index cc8c738480e8a..bf949fcc970ab 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -388,7 +388,8 @@ static void save_error_info(struct super_block *sb, const char *func, unsigned int line) { __save_error_info(sb, func, line); - ext4_commit_super(sb, 1); + if (!bdev_read_only(sb->s_bdev)) + ext4_commit_super(sb, 1); } /* -- 2.20.1