nfs4: Inode::GetDirSnapshot should not require OpenDirCookie

This commit is contained in:
Pawel Dziepak
2012-08-09 19:24:32 +02:00
parent 8afd81bae2
commit 2314d073af
5 changed files with 13 additions and 9 deletions
@@ -190,7 +190,8 @@ DirectoryCache::Revalidate()
Trash();
DirectoryCacheSnapshot* newSnapshot;
status_t result = fInode->GetDirSnapshot(&newSnapshot, NULL, &fChange);
status_t result = fInode->GetDirSnapshot(&newSnapshot, NULL, &fChange,
fAttrDir);
if (result != B_OK) {
oldSnapshot->ReleaseReference();
return B_OK;
+1 -1
View File
@@ -94,7 +94,7 @@ public:
status_t GetDirSnapshot(DirectoryCacheSnapshot**
_snapshot, OpenDirCookie* cookie,
uint64* _change);
uint64* _change, bool attribute);
protected:
Inode();
@@ -145,7 +145,7 @@ Inode::ReadDirUp(struct dirent* de, uint32 pos, uint32 size)
status_t
Inode::GetDirSnapshot(DirectoryCacheSnapshot** _snapshot,
OpenDirCookie* cookie, uint64* _change)
OpenDirCookie* cookie, uint64* _change, bool attribute)
{
DirectoryCacheSnapshot* snapshot = new DirectoryCacheSnapshot;
if (snapshot == NULL)
@@ -161,7 +161,7 @@ Inode::GetDirSnapshot(DirectoryCacheSnapshot** _snapshot,
DirEntry* dirents;
status_t result = ReadDirOnce(&dirents, &count, cookie, &eof, &change,
&dirCookie, &dirCookieVerf);
&dirCookie, &dirCookieVerf, attribute);
if (result != B_OK) {
delete snapshot;
return result;
@@ -177,7 +177,7 @@ Inode::GetDirSnapshot(DirectoryCacheSnapshot** _snapshot,
continue;
ino_t id;
if (!cookie->fAttrDir) {
if (!attribute) {
if (dirents[i].fAttrCount == 2)
id = FileIdToInoT(dirents[i].fAttrs[1].fData.fValue64);
else
@@ -228,7 +228,8 @@ Inode::ReadDir(void* _buffer, uint32 size, uint32* _count,
cookie->fSnapshot = cache->GetSnapshot();
if (cookie->fSnapshot == NULL) {
uint64 change;
result = GetDirSnapshot(&cookie->fSnapshot, cookie, &change);
result = GetDirSnapshot(&cookie->fSnapshot, cookie, &change,
cookie->fAttrDir);
if (result != B_OK) {
cache->Unlock();
fFileSystem->Revalidator().Unlock();
@@ -810,14 +810,15 @@ NFS4Inode::RemoveObject(const char* name, FileType type, ChangeInfo* changeInfo,
status_t
NFS4Inode::ReadDirOnce(DirEntry** dirents, uint32* count, OpenDirCookie* cookie,
bool* eof, uint64* change, uint64* dirCookie, uint64* dirCookieVerf)
bool* eof, uint64* change, uint64* dirCookie, uint64* dirCookieVerf,
bool attribute)
{
do {
RPC::Server* serv = fFileSystem->Server();
Request request(serv);
RequestBuilder& req = request.Builder();
if (cookie->fAttrDir)
if (attribute)
req.PutFH(fInfo.fAttrDir);
else
req.PutFH(fInfo.fHandle);
@@ -66,7 +66,8 @@ protected:
status_t ReadDirOnce(DirEntry** dirents, uint32* count,
OpenDirCookie* cookie, bool* eof, uint64* change,
uint64* dirCookie, uint64* dirCookieVerf);
uint64* dirCookie, uint64* dirCookieVerf,
bool attribute);
status_t OpenAttrDir(FileHandle* handle);