diff options
-rw-r--r-- | fs/nfs/dir.c | 9 | ||||
-rw-r--r-- | include/linux/nfs_fs.h | 3 |
2 files changed, 10 insertions, 2 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 88f6cf1ccf8c..1320288ff9ec 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -449,7 +449,8 @@ void nfs_force_use_readdirplus(struct inode *dir) if (nfs_server_capable(dir, NFS_CAP_READDIRPLUS) && !list_empty(&nfsi->open_files)) { set_bit(NFS_INO_ADVISE_RDPLUS, &nfsi->flags); - invalidate_mapping_pages(dir->i_mapping, 0, -1); + invalidate_mapping_pages(dir->i_mapping, + nfsi->page_index + 1, -1); } } @@ -720,6 +721,8 @@ struct page *get_cache_page(nfs_readdir_descriptor_t *desc) static int find_and_lock_cache_page(nfs_readdir_descriptor_t *desc) { + struct inode *inode = file_inode(desc->file); + struct nfs_inode *nfsi = NFS_I(inode); int res; desc->page = get_cache_page(desc); @@ -731,8 +734,10 @@ int find_and_lock_cache_page(nfs_readdir_descriptor_t *desc) res = -EAGAIN; if (desc->page->mapping != NULL) { res = nfs_readdir_search_array(desc); - if (res == 0) + if (res == 0) { + nfsi->page_index = desc->page_index; return 0; + } } unlock_page(desc->page); error: diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index c06b1fd130f3..a5f8f03ecd59 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -168,6 +168,9 @@ struct nfs_inode { struct rw_semaphore rmdir_sem; struct mutex commit_mutex; + /* track last access to cached pages */ + unsigned long page_index; + #if IS_ENABLED(CONFIG_NFS_V4) struct nfs4_cached_acl *nfs4_acl; /* NFSv4 state */ |