nfs4: DirectoryCache::GetSnapshot may return NULL
This commit is contained in:
@@ -54,7 +54,7 @@ public:
|
||||
bool created = false);
|
||||
void RemoveEntry(const char* name);
|
||||
|
||||
inline DirectoryCacheSnapshot* GetSnapshot();
|
||||
inline status_t GetSnapshot(DirectoryCacheSnapshot** snapshot);
|
||||
|
||||
inline SinglyLinkedList<NameCacheEntry>& EntriesList();
|
||||
|
||||
@@ -113,12 +113,16 @@ DirectoryCache::Valid()
|
||||
}
|
||||
|
||||
|
||||
inline DirectoryCacheSnapshot*
|
||||
DirectoryCache::GetSnapshot()
|
||||
inline status_t
|
||||
DirectoryCache::GetSnapshot(DirectoryCacheSnapshot** snapshot)
|
||||
{
|
||||
ASSERT(snapshot != NULL);
|
||||
|
||||
status_t result = B_OK;
|
||||
if (fDirectoryCache == NULL)
|
||||
_LoadSnapshot(false);
|
||||
return fDirectoryCache;
|
||||
result = _LoadSnapshot(false);
|
||||
*snapshot = fDirectoryCache;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -324,8 +324,12 @@ Inode::ReadDir(void* _buffer, uint32 size, uint32* _count,
|
||||
return result;
|
||||
}
|
||||
|
||||
DirectoryCacheSnapshot* snapshot = cache->GetSnapshot();
|
||||
ASSERT(snapshot != NULL);
|
||||
DirectoryCacheSnapshot* snapshot;
|
||||
result = cache->GetSnapshot(&snapshot);
|
||||
if (result != B_OK) {
|
||||
cache->Unlock();
|
||||
return result;
|
||||
}
|
||||
|
||||
cookie->fSnapshot = new DirectoryCacheSnapshot(*snapshot);
|
||||
cache->Unlock();
|
||||
|
||||
Reference in New Issue
Block a user