nfs4: Disable file cache to invalidate it

* When resetting the file cache, use file_cache_disable() to remove
  all pages, instead of calling file_cache_delete().
* Possible fix for #19656.

file_cache_delete doesn't actually delete the VMCache object, so when
file_cache_create() is called the returned file_cache_ref just points
to the same VMCache as before.

Change-Id: Ifba42b51c52f11980fd97212d0c3bdfdc1e55085
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9448
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Jim906
2025-07-09 17:57:29 +00:00
committed by waddlesplash
parent ceec330bbb
commit d0b07ec244
@@ -173,14 +173,19 @@ Inode::RevalidateFileCache()
return B_OK;
SyncAndCommit(true);
file_cache_delete(fFileCache);
result = file_cache_disable(fFileCache);
if (result != B_OK) {
INFORM("RevalidateFileCache: failed to disable cache\n");
return result;
}
struct stat st;
fMetaCache.InvalidateStat();
result = Stat(&st);
if (result == B_OK)
fMaxFileSize = st.st_size;
fFileCache = file_cache_create(fFileSystem->DevId(), ID(), fMaxFileSize);
file_cache_set_size(fFileCache, fMaxFileSize);
file_cache_enable(fFileCache);
fChange = change;
return B_OK;