OSDN Git Service

NFSv4: Declare the size up to date after it was set.
authorTrond Myklebust <trond.myklebust@primarydata.com>
Tue, 27 Mar 2018 21:10:42 +0000 (17:10 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Tue, 10 Apr 2018 20:06:22 +0000 (16:06 -0400)
When we've changed the file size, then ensure we declare it to be
up to date in the inode attributes.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/inode.c
fs/nfs/write.c

index a2c5d4a..ba73eda 100644 (file)
@@ -646,6 +646,7 @@ static int nfs_vmtruncate(struct inode * inode, loff_t offset)
        /* Optimisation */
        if (offset == 0)
                NFS_I(inode)->cache_validity &= ~NFS_INO_INVALID_DATA;
+       NFS_I(inode)->cache_validity &= ~NFS_INO_INVALID_SIZE;
 
        spin_unlock(&inode->i_lock);
        truncate_pagecache(inode, offset);
index 3efce54..541471a 100644 (file)
@@ -231,6 +231,7 @@ static void nfs_grow_file(struct page *page, unsigned int offset, unsigned int c
        if (i_size >= end)
                goto out;
        i_size_write(inode, end);
+       NFS_I(inode)->cache_validity &= ~NFS_INO_INVALID_SIZE;
        nfs_inc_stats(inode, NFSIOS_EXTENDWRITE);
 out:
        spin_unlock(&inode->i_lock);