Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp3033772ybx; Fri, 8 Nov 2019 13:03:10 -0800 (PST) X-Google-Smtp-Source: APXvYqzWkLYF05zUiKVKMP4Tku+v14VIz9mUuBw7m451vDs2YJISVBDi+L6B/ySim7WPN1omynqf X-Received: by 2002:a05:6402:706:: with SMTP id w6mr13081806edx.38.1573246990416; Fri, 08 Nov 2019 13:03:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573246990; cv=none; d=google.com; s=arc-20160816; b=l9KDQ9SbQG1H9PiOH4aYwFp8QyJNIo7fawuZJx0msSpb6NWc3vyDSk7t8jXHXloPwf BBap9R6xwWcOfVGFmpLLvbAqAk6KhvS8ZeHTbTPZrfg9gBUsSURYpVhBEAYlyWDg00A6 6tft0SVdrw36YjTj6julmljO4Q0Hd+S5aee7GEco/YJNdQ44LNZo0mE155sp7HHbqs4y oP/9XjhUtbm0IWYkgphOa97qVH5cYAdNDj4kL1vSaL0A09JkKWRbSGCEyP731HLjOL0/ 4gFF2+8Ic2THHjtJdJS3O9jqwp1DJi1IxRnaIOTpY0hhItiHUY/KTQMpKJ1x76ajSpqr guyg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=Z8ebJKohpb1s42CAw3G5otQLMnl5+nXFKve/m40i4Zc=; b=R8qE6iPZ4YKDB/zDpXaTS96BrCfQZcCR4KG8CNX3phDejwUmUDfTgTk32/jytuSj5A GSxxwZviz7sFvcTmqNrjzpWjSPiI3d+bJpj3wvQHJkTBCgF2Zo9nivadqoOGh+RXeAez 8BO2d0zrFsRnrPButMRADree7MYSb2FE2un5fi1Xq6izz2ACH5/+s2O4pbA2Z/oXp8zS AfySZXsLll74+xUx48jlaGr7VetWd2dUc3zozH6Tw7Usu1RodJiv8Hl5Pz7pvj82GGAw L+6tM0vWAOX7WrZgIlO8Okjhyu+s9zbWmSiLjQNE/lAIryawu6plJMScHV/Ad6O0oxXk Ucyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=AsM6tvjq; 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=fail (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 b11si4487929ejv.278.2019.11.08.13.02.35; Fri, 08 Nov 2019 13:03:10 -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=fail header.i=@gmail.com header.s=20161025 header.b=AsM6tvjq; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726227AbfKHVC2 (ORCPT + 99 others); Fri, 8 Nov 2019 16:02:28 -0500 Received: from mail-yb1-f193.google.com ([209.85.219.193]:37643 "EHLO mail-yb1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727210AbfKHVC2 (ORCPT ); Fri, 8 Nov 2019 16:02:28 -0500 Received: by mail-yb1-f193.google.com with SMTP id q7so271237ybk.4 for ; Fri, 08 Nov 2019 13:02:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Z8ebJKohpb1s42CAw3G5otQLMnl5+nXFKve/m40i4Zc=; b=AsM6tvjqHXIWSExDWPRDmO5iTab7iaqhKOsSy4lr6JveVWHMHJYlDpa0ngyFQ0LalA qE9RH5w0+VqleGWu1Hh1/qs7dK0gshsuf4J6SbdUGjIUDerDTOngw7IoRWFsM9o08fTJ FceZRFizemMQu32fEfjzmX9WRg2BXZhCHWUH/2wsvUkALuDX68GxqKJn3227GJzbfvqJ 0w1EFCEX2xuVBNtklmxR39bnSlHWBXhBLmMp75m66R/SI3XaqDOvIYdGQwTNWpyO8NUf h+AWRP7Xw3VolALEPyjkpTK4PdZ3KbL9LIZg5vaLPhxpOzbFNzNqsPn2lMrjaqwjdLIe cP0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=Z8ebJKohpb1s42CAw3G5otQLMnl5+nXFKve/m40i4Zc=; b=N12WC/TG5p8fNKP0MsvIAIc3cghK8vT0tT2cruLVOFc/Ifve2xhA0dsB/xTJf/W+F4 99Xz+zaUTq2Qm8Bpit0k6B09FI92hOxzlURrLnNpQ8ZXqF1I6PpqiK3IBKavQSQ4T5aD gm1iauPYRUqjoFp1xFDyMEYkGY37wRjkutgY/KzeDU+7D8Qc/YtlAqiXQhFHzNVgDhdu 9di8r48HXdZ4jVSlP93U8wHdj+qTMjsjMYlgc5ij+6EU9NqXxYXwsAYk1X1fyeCx50jG pQrJAuGtc76SYQ+aGPLZHCrbQwQmEyEPS7AL0aI2/aaYLHEXfORSwhefLN+3kekvSPe6 6M1g== X-Gm-Message-State: APjAAAU84Prb9amOZqP5TSyts5jb8fL9evrpLpdYFO4YESbnKLfnTJRo Lo51a+IZamcxQpAG6NNhMO5kD3QL X-Received: by 2002:a25:ca07:: with SMTP id a7mr10872148ybg.340.1573246946597; Fri, 08 Nov 2019 13:02:26 -0800 (PST) Received: from localhost.localdomain (c-68-42-68-242.hsd1.mi.comcast.net. [68.42.68.242]) by smtp.gmail.com with ESMTPSA id p126sm1904033ywc.16.2019.11.08.13.02.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2019 13:02:25 -0800 (PST) From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: Trond.Myklebust@hammerspace.com, linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH 1/2] NFS: Add FATTR4_WORD1_SPACE_USED to the cache_consistency_bitmask Date: Fri, 8 Nov 2019 16:02:23 -0500 Message-Id: <20191108210224.33645-1-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.24.0 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 From: Anna Schumaker Changing a sparse file could have an effect not only on the file size, but also on the number of blocks used by the file in the underlying filesystem. Let's update the SPACE_USED attribute whenever we update SIZE to be as accurate as possible. This patch fixes xfstests generic/568, which tests that fallocating an unaligned range allocates all blocks touched by that range. Without this patch, `stat` reports 0 bytes used immediately after the fallocate. Adding a `sleep 5` to the test also catches the update, but it's better to just do it when we know something has changed. Signed-off-by: Anna Schumaker --- fs/nfs/nfs4proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index ac9063c06205..00a1f3ec7f22 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -3775,7 +3775,7 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f memcpy(server->cache_consistency_bitmask, res.attr_bitmask, sizeof(server->cache_consistency_bitmask)); server->cache_consistency_bitmask[0] &= FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE; - server->cache_consistency_bitmask[1] &= FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY; + server->cache_consistency_bitmask[1] &= FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY|FATTR4_WORD1_SPACE_USED; server->cache_consistency_bitmask[2] = 0; /* Avoid a regression due to buggy server */ -- 2.24.0