Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp687856ybv; Thu, 13 Feb 2020 07:47:26 -0800 (PST) X-Google-Smtp-Source: APXvYqy+0W7jEcKzAlmIPiWnSjR4VtiYL9baCgoUrU8NVJIrnMZS0V/iRqrF0s9NMBkJGVcN/ebr X-Received: by 2002:a9d:6288:: with SMTP id x8mr7956111otk.2.1581608846283; Thu, 13 Feb 2020 07:47:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581608846; cv=none; d=google.com; s=arc-20160816; b=RONnHdQ6iXiRY9ki5vzm3LlxQ0lAPsXsEOX8Y4RtydexdlanXnN4fjF188RnLk+t3R aptJqUNMozsoo16VSAhdeIT9vOB2lg0MpjQdY/wmOftMMxnNcjlaShMn38Lzd5bylNpa 6Ua6mC6DIJRTmj8TnYOBpCBri/ATfDOzdkp1MxXTRsehXsQ36DC5CCB6zzoIYDsfZY6B 62l5PkMzNClyHhf6A1Xk3z4DJstEPPfukdDH6e3dAGPi9Wc+0Tzi17f0qGDukDou/XSu 0DDEgT5+Q4cj1cUEVKL1ywANxkzw89SgimN5j6ywXeEkAwCLdpIoUREAAjLYUjSsAJtR XMXw== 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=UYCBKLov5D5ZNYDZhVMXopqPxSgiBhjh4npeSfDnKDA=; b=VgF52+CSYMbMUBun8dxLAGQuJn6GVcqIiLpTd1IvaOxM9Y4tSlt8rmExjzVW9ZFxla sNulS91mE3gzVEZ99y/aUpPb5RFefOY1Wn+LJmcKsj+Gd9bTOJes/q5bqv7Y/w9Z9Kdg VBGz2c0H/JtUuFlrgXA2clEPIoiI8ZgzmErvPxLAHVEsE7WfoqYeXOAM4jqRtT35Ur+Q dVHOrN2fuVaMjfE0Q22rE1SUCbMFzF1Fn1GXqqhuBFcQWEJPrXg+HBytUS5t/9PWMABi CMxmCmKSE9PiWfJTtV11a4nRe7CQV1hHUULLIU1HVOKcE8/ou/92kyA4KdMLoxjravZs Y4/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zCgRLh70; 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 w7si1313026oie.196.2020.02.13.07.47.13; Thu, 13 Feb 2020 07:47:26 -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=zCgRLh70; 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 S2387943AbgBMPrM (ORCPT + 99 others); Thu, 13 Feb 2020 10:47:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:49082 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387680AbgBMP1J (ORCPT ); Thu, 13 Feb 2020 10:27:09 -0500 Received: from localhost (unknown [104.132.1.104]) (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 0A96A24670; Thu, 13 Feb 2020 15:27:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581607629; bh=CuVfiS2S9a2bwNenn2jhACMneXOOC1/b5Hy9foAEjiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zCgRLh70xpMMBRl5nAzYg/eIjYrrbjnOcaAF6W6ksVkBweIxuXLUjjSG1lvB+wiip cmiMB19ZHb8F/TqyUL8ivRy3SsvVj7avoZ4hElvoIg7RCz4We6DnnwM+LAWP/KQt56 HpiKwvwfsPFE5n5vkq/X7RrrBir31LqzMAVNnIm8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust , Anna Schumaker Subject: [PATCH 5.4 28/96] NFS: Revalidate the file size on a fatal write error Date: Thu, 13 Feb 2020 07:20:35 -0800 Message-Id: <20200213151849.887788287@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200213151839.156309910@linuxfoundation.org> References: <20200213151839.156309910@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Trond Myklebust commit 0df68ced55443243951d02cc497be31fadf28173 upstream. If we suffer a fatal error upon writing a file, which causes us to need to revalidate the entire mapping, then we should also revalidate the file size. Fixes: d2ceb7e57086 ("NFS: Don't use page_file_mapping after removing the page") Signed-off-by: Trond Myklebust Signed-off-by: Anna Schumaker Signed-off-by: Greg Kroah-Hartman --- fs/nfs/write.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -243,7 +243,15 @@ out: /* A writeback failed: mark the page as bad, and invalidate the page cache */ static void nfs_set_pageerror(struct address_space *mapping) { + struct inode *inode = mapping->host; + nfs_zap_mapping(mapping->host, mapping); + /* Force file size revalidation */ + spin_lock(&inode->i_lock); + NFS_I(inode)->cache_validity |= NFS_INO_REVAL_FORCED | + NFS_INO_REVAL_PAGECACHE | + NFS_INO_INVALID_SIZE; + spin_unlock(&inode->i_lock); } static void nfs_mapping_set_error(struct page *page, int error)