void invalidate_cache()

in turbonfs/inc/nfs_inode.h [1705:1749]


    void invalidate_cache(bool purge_now = false, bool shutdown = false)
    {
        /*
         * shutdown implies force purging which only makes sense if purge_now
         * is true.
         */
        assert(!shutdown || purge_now);

        if (is_dir()) {
            if (has_dircache()) {
                assert(dircache_handle);
                AZLogDebug("[{}] Invalidating dircache", get_fuse_ino());
                dircache_handle->invalidate();

                if (purge_now) {
                    AZLogDebug("[{}] (Purgenow) Purging dircache", get_fuse_ino());
                    dircache_handle->clear();
                    AZLogDebug("[{}] (Purgenow) Purged dircache", get_fuse_ino());
                }
            }
        } else if (is_regfile()) {
            if (has_filecache()) {
                assert(filecache_handle);
                AZLogDebug("[{}] Invalidating filecache", get_fuse_ino());
                filecache_handle->invalidate();

                if (purge_now) {
                    /*
                     * Wait for ongoing readaheads to complete, else they would
                     * not have dropped membuf lock and inuse count, and clear()
                     * would incorrectly complain.
                     */
                    if (has_rastate()) {
                        get_rastate()->wait_for_ongoing_readahead();
                    }

                    AZLogDebug("[{}] (Purgenow) {}Purging filecache",
                               get_fuse_ino(), shutdown ? "Force ": "");
                    filecache_handle->clear(shutdown /* shutdown */);
                    AZLogDebug("[{}] (Purgenow) {}Purged filecache",
                               get_fuse_ino(), shutdown ? "Force ": "");
                }
            }
        }
    }