Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5252731imu; Tue, 15 Jan 2019 14:08:12 -0800 (PST) X-Google-Smtp-Source: ALg8bN6Fv9PfMql2qKv4QmD6Cdig7fNY+6wphJz2OR3q4qupLE4ielh6U5uhCuiTmAU0MRzopMWs X-Received: by 2002:a17:902:5ac7:: with SMTP id g7mr6409149plm.212.1547590092273; Tue, 15 Jan 2019 14:08:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547590092; cv=none; d=google.com; s=arc-20160816; b=VBxwamnLR55cCuAkyjw2Bth2o4WBasDw1ogJLgsSlGm2z2L3Z5cSngQkuRBXfT4hvf jzYDeDdcT91EZu6PSLes0303fTUgk4nvEJiXz6yFpqtfG4w6rXLcSyXooiMXO93SuIlT fi+EKSzGOJy1qdv6R2Nl3usvYxiF0opIwx2AMtsBraIhn9CO+qbMPruPdCB+c2R4cG/D 2Lerg6WPehdK0nIa2LCgxLMtE0b3Mk6BZQDVQKYY6JBesE34qswWbAVqLBvEMdmZyF3o aD0AedMs3ImCiQwjHvm+HKWL2lzBqtpuHHlj+dO/2xh840F0/6piwgOU94k0WfD6EuWt d+5A== 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=AQW34xp1ikpw6hgCr2bnbU94059PZWK4FBgBs1LRPnE=; b=hfP9EdgiMv19cQB5HKIeQL+hMxhClabOwcCgpFAX8Viu0IbRHm0Wa3FZgfUgCuSwcV aTIIE8ZK6lkWyVlU9ya4AvoGnEqGsSQ+mxi2UEQ75eHnifPV19kYD7nzab7FO6BXReFv zmBW/uV4QXOdYoOz+GX/IRf0NRoP9MuvTfTnSMvPa0D19Mht9g6Y3nhDiEFwHfYILikE LtRdYmcxm4Tg0C9RCMu0sePfj+RNj0CBM3JWYRvTyeBq1SzyskYhH0u7L6Fez3g4KOOc 1i8GndZdkwGZVrGmjzEp3jJEXE/h9bwTga2WnpZnmeWh16hkoCGtrflaWBcWb4f2dz7D Pg6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="To/oRL9t"; 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 v2si4072721plz.53.2019.01.15.14.07.53; Tue, 15 Jan 2019 14:08:12 -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="To/oRL9t"; 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 S2387801AbfAOQp3 (ORCPT + 99 others); Tue, 15 Jan 2019 11:45:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:35162 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387723AbfAOQp1 (ORCPT ); Tue, 15 Jan 2019 11:45:27 -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 128122054F; Tue, 15 Jan 2019 16:45:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547570726; bh=7B5qYllohnDaA7tSePslQy7YHJTLmUFVcxydsXAr0i0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=To/oRL9tnw+tyZsPxkW6577f4tbmaY80DpzEzOsRwJ0XiPASr9N4iSEhkaqVDDJsA KQE94tDwZc6JwE5XAFm4jIIuEtQoTeZ0pXDlq1HtovY3Qg18KJu5YHqKUYD12xCe7Z hxngMPe6i9Z30B48bD6bKx8axbm6s7HvG7AlS4ms= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Theodore Tso Subject: [PATCH 4.20 49/57] ext4: avoid kernel warning when writing the superblock to a dead device Date: Tue, 15 Jan 2019 17:36:30 +0100 Message-Id: <20190115154913.763968826@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190115154910.734892368@linuxfoundation.org> References: <20190115154910.734892368@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.20-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 @@ -4905,7 +4905,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