Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp21845058ybl; Mon, 6 Jan 2020 12:27:48 -0800 (PST) X-Google-Smtp-Source: APXvYqzkRBkUItv7dcKJaRzaeYAeRlvVBOwfln7YUlj2r1f0F3HfX3K+ms8tTkgz9tAGNJQdPdIA X-Received: by 2002:a05:6830:155a:: with SMTP id l26mr2257675otp.339.1578342468638; Mon, 06 Jan 2020 12:27:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578342468; cv=none; d=google.com; s=arc-20160816; b=HMH4Mk5cv6U9NmWSlX4D2MuXhm3M7/29imXJ/X8CgEs+GJnJmkVl+tiZJLEscEZX59 le+dE3B8Up2STwqz4YVBYJd0FTywpswqe4UZojmbPl1HPiSvZTz9KAmWUag2cfJjMDDd F9PYVGDNJCt6tyaPCu8jPp1RS8UEGoornm0qStN4TrNqpAzgdkeVL8AN3kNphjYCWrpE /mDIMKXa2IeeJLsRsWudyDfs1RfkVcwnBLj+Yb/+qEzvpKmhsxL2l+gJzv65Lx6x9LpC bd1WHE3ObqIB44XcZyROmDpcw6tU/nUygNcsGMRmGgUSbSG/6szqPiN3g0KrwGJQ5TK8 fmTg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qaen0ufwEJUB0Fs5mUM2TOjyjCuqbGSEbjqXbGFQrT4=; b=FKjoKYUxGczYp5s9Qt4e9S7op/v6sUhaOY8R27aWzwzGf1isec+5AazZJy+djVy9uB 8eykgL/hqRJIBdxLM0rzmh/4ogc1vneSvwcv7WAuRVOKk+zMcxYs9kHm45dalJhNAIzC zgroF1ZAQOJnK3vjIY4mXARLzSQSrm8xKf7dx2eIRTb9pibOeps03WTvjsQm1nnmSZro VpTZs651KXzOqF0fax5/FOqbbd9IsnLobOY2fop0YV9ow4BsgYqP3IlD5Jxh0Mhun23A HeZAuZOVqGMSFEJKDkkqBtFaG3UO8SOqPVyfYgc5C2QgT2gEzmjoL2q3WCCZ2ZkMjVvZ qcrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=khgcauH4; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l16si32360954otj.59.2020.01.06.12.27.29; Mon, 06 Jan 2020 12:27:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-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=@gmail.com header.s=20161025 header.b=khgcauH4; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726699AbgAFU12 (ORCPT + 99 others); Mon, 6 Jan 2020 15:27:28 -0500 Received: from mail-yw1-f68.google.com ([209.85.161.68]:45022 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726657AbgAFU11 (ORCPT ); Mon, 6 Jan 2020 15:27:27 -0500 Received: by mail-yw1-f68.google.com with SMTP id t141so22415252ywc.11 for ; Mon, 06 Jan 2020 12:27:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qaen0ufwEJUB0Fs5mUM2TOjyjCuqbGSEbjqXbGFQrT4=; b=khgcauH4hu8vaTBoO0tgG3F5OHDPz30KOocgVg03VxlohkhsItLOerA/PtpwBj1gAH FxziM0FvF8CsgBvlXzt/gwPMRkvOLsXvwgPvTwSPE/dfgIo+/6pkU1RyZAKZiAORQhNc hjuD1WitQr80QAHqYrcqjYhLz0Hw4Qtv3AuT8DKlpcu8dP/H2mKzLJd6H4uEWzZce0Yz saQCcqz+ODXnKSoT5G+Z9EghT84UD/un65FyjNQzMDY4v6hJHF1XfueAQUYQUt3+Iyvm vMe4gMXX0uUnipEpq6HXegE8yHm9M8+9TZT+REjuUycPVt7dl0FWAK7vjog7eQ/1ebE5 TsoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qaen0ufwEJUB0Fs5mUM2TOjyjCuqbGSEbjqXbGFQrT4=; b=uMXjDxKo2HoXNAB8B69xBIAmVjmepP8Ymq2VwvzeeUv6g8vNoBOi2+E4hP/RyegrxO /pVoGho6lGW++3UUiyPDCKWmcAehRNEbQD1sEdXdkoA8LmBtiiHydWXkXsvdE85kELkI 8RpRtfe1bjIetJxUCN5Lv49G4EDzWepiCFQJ/fF5J3xaCtblrncnUVaO02S/kAgQtVPW Cuzk1zx5vhrV5kt50MmUg4G57aBOcfQGF2JmawGCiMk+0pZdI5gUC+xnuUH9ApOWlzFE CwLIHCF9gKLAwAHyfx3Mgg+yxCRGEt81SSpNpE9ezBwUKnVBQRbWO/10woFxNU9qgZ70 Nk4w== X-Gm-Message-State: APjAAAVqR8EcxHYfCTQqyCeKml11yHFRaQ/NyR/RBWvWycg0n4+1qxUa UG1sO2FAhKggyNkX0oTiZQ== X-Received: by 2002:a81:6785:: with SMTP id b127mr82129080ywc.56.1578342446484; Mon, 06 Jan 2020 12:27:26 -0800 (PST) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id l200sm28723579ywl.106.2020.01.06.12.27.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 12:27:25 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 01/15] NFS: Revalidate the file size on a fatal write error Date: Mon, 6 Jan 2020 15:25:00 -0500 Message-Id: <20200106202514.785483-2-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200106202514.785483-1-trond.myklebust@hammerspace.com> References: <20200106202514.785483-1-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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 --- fs/nfs/write.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 52cab65f91cf..f5170bc839aa 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -243,7 +243,15 @@ static void nfs_grow_file(struct page *page, unsigned int offset, unsigned int c /* 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) -- 2.24.1