Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp47380imu; Tue, 15 Jan 2019 16:18:08 -0800 (PST) X-Google-Smtp-Source: ALg8bN7QnLPM7wZDGUWMySi+HMs/tEe2LMd1qddmPtHbcMYDirj9ZVl9PFM4gNIZbgM4EvWNn/zH X-Received: by 2002:a17:902:6a8c:: with SMTP id n12mr6892505plk.85.1547597888022; Tue, 15 Jan 2019 16:18:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547597888; cv=none; d=google.com; s=arc-20160816; b=qU5jVnIxifHRUflAi0iPf6v5Ym9w514BeYrcWWn+/S6b4qewW8LlcEyWKxLE148sym pTenpIXGCTXzjAzHpZnnmOZF5VJn5zRqlYhy1azGniosZn/sJpiuTHcvXvkUCXX2YsM/ PFo8UiC/zFTHVjpzxpyplglH8jjGD8dVPB9thEm1cNJbCZtFm7KJJUwDZsPfKLarDaTC fl0T798JjoovwxRi4wtzrapoC0eVjQwjn/SXLr/aC4iTcyrfzBWPbruVgyiX4ahjcOfy cPz1S5xfPbXtCM1k+F7JOOC28zkaXH9c4MwARdrRIFkGureonXeauiGzZhWEqZ8VBgit h0qA== 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=K43q/0pmcD/se6ElKCkY/EJYXmEevCmsI1r3kFOol1E=; b=PLq5w8NsaXsTiwa71CcTNi2qcBl72cwXbDOVHbABloE5EMZxytK/NagY47fcQCa/Wr RttXsZlhO549Y3W5Dl/1/TZ1juozabknB4H+CMgAG5htaqTcTGuyamWJI43roRa04kbh NuA9b7q4A0du45CBpR6pFg1bgQYkc+iYy6gss87bsjkN/P3B1A4rvTqvoc/2D6OZqOJC mNHjGm++OFB/mQUcdsOIgpLBGCXlXK4VS0bnkQC4KUsXs4GGTQy5HW88TAv4YSj0OlMz NiFb8Zw63Um/PxUBcBEp6KBbt4PEcFmGnYZziwAHy/TXMasxvZ7Z+pb8Rn4JHGLvhDa5 Fp6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ii6YyPSc; 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 y191si4454366pgd.4.2019.01.15.16.17.51; Tue, 15 Jan 2019 16:18:08 -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=ii6YyPSc; 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 S1730552AbfAOQ7M (ORCPT + 99 others); Tue, 15 Jan 2019 11:59:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:55636 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729401AbfAOQja (ORCPT ); Tue, 15 Jan 2019 11:39:30 -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 9BD372054F; Tue, 15 Jan 2019 16:39:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547570369; bh=cEDnNehdEbI+1Eo1L3mFAnnF843SqOjg6Txo2fEMBwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ii6YyPSc1Dy2x62tM8ls/JVQfbZ92WKPfHcT6bsIn1A+Lt2tVFRQM3V5XkmS7RSfR ubgQS7mlHd+6UWQJi+ecO+vjak4PKBbMjJ7lljThhUjA0DfPdKp5zYlWKp2vw4bdTk TtP+Bhv2xR2b1ClBygIs4skPwreR+O6B3r68Mzmk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Theodore Tso Subject: [PATCH 4.9 15/16] ext4: avoid kernel warning when writing the superblock to a dead device Date: Tue, 15 Jan 2019 17:35:58 +0100 Message-Id: <20190115154850.004102144@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190115154848.164648613@linuxfoundation.org> References: <20190115154848.164648613@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.9-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 @@ -4679,7 +4679,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