From bef774d30c285bdf209b474f4c45bdc2dfb7d7bb Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Tue, 9 Nov 2021 17:56:34 -0500 Subject: [PATCH] libntfs: Add assertion that the entry is not already in the cache. There is a big scary warning about this, but no code actually checks for it. This would have saved me some time in development... --- src/add-ons/kernel/file_systems/ntfs/libntfs/inode.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/add-ons/kernel/file_systems/ntfs/libntfs/inode.c b/src/add-ons/kernel/file_systems/ntfs/libntfs/inode.c index 8819ff1dcb..92c78f37b7 100644 --- a/src/add-ons/kernel/file_systems/ntfs/libntfs/inode.c +++ b/src/add-ons/kernel/file_systems/ntfs/libntfs/inode.c @@ -534,6 +534,12 @@ int ntfs_inode_close(ntfs_inode *ni) item.pathname = (const char*)NULL; item.varsize = 0; debug_cached_inode(ni); +#if defined(__HAIKU__) + if (ntfs_fetch_cache(ni->vol->nidata_cache, + GENERIC(&item), idata_cache_compare)) { + panic("ntfs_inode_close: %llu already in cache!", ni->mft_no); + } +#endif ntfs_enter_cache(ni->vol->nidata_cache, GENERIC(&item), idata_cache_compare); }