Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp116490imu; Tue, 15 Jan 2019 17:53:29 -0800 (PST) X-Google-Smtp-Source: ALg8bN6I9e7+sH/3SoKn63exFFqAvio0nSBxO/rtFWxwM9wfjN5PHvUSV67hMtUMa2up4kO6lbgE X-Received: by 2002:a63:24c2:: with SMTP id k185mr6361695pgk.406.1547603609783; Tue, 15 Jan 2019 17:53:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547603609; cv=none; d=google.com; s=arc-20160816; b=w6TV60e7j4Sw2mkz6DCci+to7eN6CX3oEmHLL2ZICuJLgsbaz0VAmqJFVh+ENwKl2/ iVwpl4kEVtZoQiNwalhDgnzQ79xJ18oGPq1p7ybQamvffZ2YNDXPY/qJi5Eft/qXDx73 +YnV5WghtsC3Ekasd0dcW3M+kPhWxnRhp/HKqH6fZrGLa7pAUgUhKPkWyQUsJjPFWTwt NqA/DID9IaTEDQNN7E8bjgPBLMzjyZirrf63BzJsZNdNdNJo1iF+lKnX8T2S4jeVKlt0 bDo1IU5MVtsOJEhU95t9uEtJ2u78qTKPCJUPUfbpokwce3q6OSE6S3YtDzjJcYnDxtA1 GWSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=p4R0u/awI3vvR2ORQBhPtgT/170ujQP9XmWdU0hsJWk=; b=UA/vTlBBnODqH2XZOnbY6kbd5a8saHqJvs7zYAENLM1JAX4xRhgCJK/uRF24+liogR A+5LQU6x3rnmPyDnrmqY5q9r457oey2BbYHTb6I6k7RJsNXFlXBTgaxJdCDoAInRjSSP ZmOtZQEV9aNIP/zGktZwJDCpN1FbVPUp/jinH7DQm2vSPIi4dyvo8IrS4SM6/6GLpvyx YUFGIkWlXfjBZHitDWJTkA6Z+KDOPG5ZGyQHG/TJ3KbHct5TcnSkQTspBKtUKCJkkvQ+ AgPE3ur4zTFi5ErYeke9ZA4p0GqOxTR2D517k5ypIPtiqfQAxwSe8JAP+O7kRrdydPx/ biMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=A6RiRnlZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u91si5070623plb.237.2019.01.15.17.53.13; Tue, 15 Jan 2019 17:53:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=A6RiRnlZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732611AbfAOQ5k (ORCPT + 99 others); Tue, 15 Jan 2019 11:57:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:57076 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732622AbfAOQki (ORCPT ); Tue, 15 Jan 2019 11:40:38 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 6C25220675; Tue, 15 Jan 2019 16:40:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547570437; bh=WLbmiMVyALSaepUlyrPePVHKmZvXHIwPic2ts1HD83M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A6RiRnlZFQoOrQNCfRB4yhlf9RwwNs+XDbfndmkOQk83WOty3pokEaOVvU1ACshTw i/+wymM36nXePWHT/6shbYPZnBN9Jz+0hyjHAau+boLUATYSfeX25nPXQ7aArwkKIl lVTeClU4CEgWoF4TFZB1hwhT9lh/vGM4aUtQTjUU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Theodore Tso Subject: [PATCH 4.14 23/27] ext4: avoid kernel warning when writing the superblock to a dead device Date: Tue, 15 Jan 2019 17:36:12 +0100 Message-Id: <20190115154902.845768975@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190115154901.189747728@linuxfoundation.org> References: <20190115154901.189747728@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Theodore Ts'o commit e86807862e6880809f191c4cea7f88a489f0ed34 upstream. The xfstests generic/475 test switches the underlying device with dm-error while running a stress test. This results in a large number of file system errors, and since we can't lock the buffer head when marking the superblock dirty in the ext4_grp_locked_error() case, it's possible the superblock to be !buffer_uptodate() without buffer_write_io_error() being true. We need to set buffer_uptodate() before we call mark_buffer_dirty() or this will trigger a WARN_ON. It's safe to do this since the superblock must have been properly read into memory or the mount would have been successful. So if buffer_uptodate() is not set, we can safely assume that this happened due to a failed attempt to write the superblock. Signed-off-by: Theodore Ts'o Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- fs/ext4/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4844,7 +4844,7 @@ static int ext4_commit_super(struct supe ext4_superblock_csum_set(sb); if (sync) lock_buffer(sbh); - if (buffer_write_io_error(sbh)) { + if (buffer_write_io_error(sbh) || !buffer_uptodate(sbh)) { /* * Oh, dear. A previous attempt to write the * superblock failed. This could happen because the