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