nfs4: Check for reace conditions in filehandle recovery

This commit is contained in:
Pawel Dziepak
2012-06-29 02:15:25 +02:00
parent b75edefd15
commit 4318f15fa1
2 changed files with 21 additions and 3 deletions
+20 -3
View File
@@ -1575,8 +1575,10 @@ Inode::_HandleErrors(uint32 nfs4Error, RPC::Server* serv,
// filehandle has expired
case NFS4ERR_FHEXPIRED:
_LookUpFilehandle();
return true;
if (_LookUpFilehandle() == B_OK)
return true;
else
return false;
// filesystem has been moved
case NFS4ERR_MOVED:
@@ -1635,6 +1637,14 @@ Inode::_LookUpFilehandle()
req.GetFH();
if (fFilesystem->IsAttrSupported(FATTR4_FILEID)) {
AttrValue attr;
attr.fAttribute = FATTR4_FILEID;
attr.fFreePointer = false;
attr.fData.fValue64 = fFileId;
req.Verify(&attr, 1);
}
status_t result = request.Send();
if (result != B_OK)
return result;
@@ -1645,6 +1655,13 @@ Inode::_LookUpFilehandle()
for (uint32 i = 0; i < lookupCount; i++)
reply.LookUp();
return reply.GetFH(&fHandle);
result = reply.GetFH(&fHandle);
if (result != B_OK)
return result;
if (fFilesystem->IsAttrSupported(FATTR4_FILEID))
return reply.Verify();
else
return B_OK;
}
@@ -734,6 +734,7 @@ ReplyInterpreter::_NFS4ErrorToHaiku(uint32 x)
case NFS4ERR_LOCKED:
case NFS4ERR_GRACE:
return B_WOULD_BLOCK;
case NFS4ERR_FHEXPIRED: return B_ENTRY_NOT_FOUND;
// ...
default: return B_ERROR;
}