Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1412469imm; Thu, 5 Jul 2018 22:54:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdGXNJj0paZuFepNrTzwfktoRHF/Sj3dU5eBRJ9RrAhlU8aVr6XduviJCpGUOvMSZfJwoml X-Received: by 2002:a17:902:76c4:: with SMTP id j4-v6mr8917794plt.19.1530856494672; Thu, 05 Jul 2018 22:54:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530856494; cv=none; d=google.com; s=arc-20160816; b=LPw+lkHmyfWyBEDWeE4ZaKkkY2hBVtPdBxW64fo8pDnE2ug2I+gklONGZjmspyHgmI 1+3N4DXieB+6BNinVS/J3Xg3bxZ7idzsspvQFhGaz4WyjweoK3aLhQn4co5hOUWx7oSM KktJ5hYOTk007Aw2MgCYYakcgw+03/x2UbePHUNLCy4UBq1vkgCrDvhpKtLoMdKYwsSd EMn9gQscoimVfc+1tl7mrFf18cTuUbf/kwBfFXfYb/fpEty7oIEWzL9BvlrO1exfkEyE fIJ9wuaTbDzKrvmp1L5ZgPeOcxctYm6SeLLuN+9i+RDS6p6glIG+9i3eICr92DOkEFAI UNrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=7ZPWyq/gIboRlIKJhQVbhEAw+CoAWDMorTms9rLhX4U=; b=d+JAPcyFbIczThQry/OExeHMTbOWQaN8K01odCOCSiHxn5VOSvyUQ4IzJQdvFBVkxR GxwTGpS7LeoY5ReNAEh1P/pphKEnX5jQBRL0uofB87g62WgPk6z4Qfla5KYkRcySb53R dTiZ1PLRTkdcs39aZJSPKiH6lX4zMYPpWcIZsBBag29t7m5HMwcynPHuY0T/YjKHVjdK IaL/iM4I/gat5hyh9kG1PBgxNLZAptAKK8EyhMcE6dtE74Xa5fVLQhzSObyF1ZizT3vj /PRv5+H1XjdD43gYh/hx1nWzr6YxAvTVlu5Y81mKd5vvKzhc8ACzge0ikdO6EDuK4Oqt Vrcg== ARC-Authentication-Results: i=1; mx.google.com; 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 f17-v6si6878023pgv.383.2018.07.05.22.54.40; Thu, 05 Jul 2018 22:54:54 -0700 (PDT) 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; 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 S933854AbeGFFx3 (ORCPT + 99 others); Fri, 6 Jul 2018 01:53:29 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34076 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934657AbeGFFxB (ORCPT ); Fri, 6 Jul 2018 01:53:01 -0400 Received: from localhost (D57D388D.static.ziggozakelijk.nl [213.125.56.141]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 2BD1486A; Fri, 6 Jul 2018 05:53:01 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , Jeff Layton , Brian Foster , Sasha Levin Subject: [PATCH 4.14 56/61] fs: clear writeback errors in inode_init_always Date: Fri, 6 Jul 2018 07:47:20 +0200 Message-Id: <20180706054714.478391794@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180706054712.332416244@linuxfoundation.org> References: <20180706054712.332416244@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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: "Darrick J. Wong" [ Upstream commit 829bc787c1a0403e4d886296dd4d90c5f9c1744a ] In inode_init_always(), we clear the inode mapping flags, which clears any retained error (AS_EIO, AS_ENOSPC) bits. Unfortunately, we do not also clear wb_err, which means that old mapping errors can leak through to new inodes. This is crucial for the XFS inode allocation path because we recycle old in-core inodes and we do not want error state from an old file to leak into the new file. This bug was discovered by running generic/036 and generic/047 in a loop and noticing that the EIOs generated by the collision of direct and buffered writes in generic/036 would survive the remount between 036 and 047, and get reported to the fsyncs (on different files!) in generic/047. Signed-off-by: Darrick J. Wong Reviewed-by: Jeff Layton Reviewed-by: Brian Foster Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/inode.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/inode.c +++ b/fs/inode.c @@ -177,6 +177,7 @@ int inode_init_always(struct super_block mapping->a_ops = &empty_aops; mapping->host = inode; mapping->flags = 0; + mapping->wb_err = 0; atomic_set(&mapping->i_mmap_writable, 0); mapping_set_gfp_mask(mapping, GFP_HIGHUSER_MOVABLE); mapping->private_data = NULL;