{
        if (!list_empty(&NFS_I(dir)->open_files)) {
                nfs_advise_use_readdirplus(dir);
-               nfs_zap_mapping(dir, dir->i_mapping);
+               invalidate_mapping_pages(dir->i_mapping, 0, -1);
        }
 }
 
        goto out;
 }
 
-static bool nfs_dir_mapping_need_revalidate(struct inode *dir)
-{
-       struct nfs_inode *nfsi = NFS_I(dir);
-
-       if (nfs_attribute_cache_expired(dir))
-               return true;
-       if (nfsi->cache_validity & NFS_INO_INVALID_DATA)
-               return true;
-       return false;
-}
-
 /* The file offset position represents the dirent entry number.  A
    last cookie cache takes care of the common case of reading the
    whole directory.
        desc->decode = NFS_PROTO(inode)->decode_dirent;
        desc->plus = nfs_use_readdirplus(inode, ctx) ? 1 : 0;
 
-       if (ctx->pos == 0 || nfs_dir_mapping_need_revalidate(inode))
+       if (ctx->pos == 0 || nfs_attribute_cache_expired(inode))
                res = nfs_revalidate_mapping(inode, file->f_mapping);
        if (res < 0)
                goto out;