nfs4: we can not use LOOKUPP on regular files when recovering file handle
This commit is contained in:
parent
bbd26dbf1e
commit
4c2a56efe8
@ -14,7 +14,8 @@
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
FileInfo::ParsePath(RequestBuilder& req, uint32& count, const char* _path)
|
FileInfo::ParsePath(RequestBuilder& req, uint32& count, const char* _path,
|
||||||
|
bool getFileHandle)
|
||||||
{
|
{
|
||||||
ASSERT(_path != NULL);
|
ASSERT(_path != NULL);
|
||||||
|
|
||||||
@ -36,6 +37,8 @@ FileInfo::ParsePath(RequestBuilder& req, uint32& count, const char* _path)
|
|||||||
count++;
|
count++;
|
||||||
} else if (strcmp(pathStart, ".")) {
|
} else if (strcmp(pathStart, ".")) {
|
||||||
req.LookUp(pathStart);
|
req.LookUp(pathStart);
|
||||||
|
if (getFileHandle)
|
||||||
|
req.GetFH();
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -93,15 +96,14 @@ FileInfo::UpdateFileHandles(FileSystem* fs)
|
|||||||
RequestBuilder& req = request.Builder();
|
RequestBuilder& req = request.Builder();
|
||||||
|
|
||||||
req.PutRootFH();
|
req.PutRootFH();
|
||||||
|
req.GetFH();
|
||||||
|
|
||||||
uint32 lookupCount = 0;
|
uint32 lookupCount = 0;
|
||||||
status_t result;
|
status_t result = ParsePath(req, lookupCount, fs->Path(), true);
|
||||||
|
|
||||||
result = ParsePath(req, lookupCount, fs->Path());
|
|
||||||
if (result != B_OK)
|
if (result != B_OK)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
result = ParsePath(req, lookupCount, fPath);
|
result = ParsePath(req, lookupCount, fPath, true);
|
||||||
if (result != B_OK)
|
if (result != B_OK)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
@ -113,19 +115,25 @@ FileInfo::UpdateFileHandles(FileSystem* fs)
|
|||||||
req.Verify(&attr, 1);
|
req.Verify(&attr, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
req.GetFH();
|
|
||||||
req.LookUpUp();
|
|
||||||
req.GetFH();
|
|
||||||
|
|
||||||
result = request.Send();
|
result = request.Send();
|
||||||
if (result != B_OK)
|
if (result != B_OK)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
ReplyInterpreter& reply = request.Reply();
|
ReplyInterpreter& reply = request.Reply();
|
||||||
|
|
||||||
|
FileHandle parent;
|
||||||
|
FileHandle child;
|
||||||
|
|
||||||
reply.PutRootFH();
|
reply.PutRootFH();
|
||||||
for (uint32 i = 0; i < lookupCount; i++)
|
reply.GetFH(&child);
|
||||||
|
parent = child;
|
||||||
|
for (uint32 i = 0; i < lookupCount; i++) {
|
||||||
reply.LookUp();
|
reply.LookUp();
|
||||||
|
parent = child;
|
||||||
|
result = reply.GetFH(&child);
|
||||||
|
if (result != B_OK)
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
if (fs->IsAttrSupported(FATTR4_FILEID)) {
|
if (fs->IsAttrSupported(FATTR4_FILEID)) {
|
||||||
result = reply.Verify();
|
result = reply.Verify();
|
||||||
@ -133,12 +141,9 @@ FileInfo::UpdateFileHandles(FileSystem* fs)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
reply.GetFH(&fHandle);
|
fHandle = child;
|
||||||
if (reply.LookUpUp() == B_ENTRY_NOT_FOUND) {
|
fParent = parent;
|
||||||
fParent = fHandle;
|
|
||||||
return B_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
return reply.GetFH(&fParent);
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ struct FileInfo {
|
|||||||
status_t UpdateFileHandles(FileSystem* fs);
|
status_t UpdateFileHandles(FileSystem* fs);
|
||||||
|
|
||||||
static status_t ParsePath(RequestBuilder& req, uint32& count,
|
static status_t ParsePath(RequestBuilder& req, uint32& count,
|
||||||
const char* _path);
|
const char* _path, bool getFileHandle = false);
|
||||||
|
|
||||||
status_t CreateName(const char* dirPath, const char* name);
|
status_t CreateName(const char* dirPath, const char* name);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user