nfs4: NFS4Object::HandleErrors needs OpenState or OpenFileCookie object

This commit is contained in:
Pawel Dziepak
2012-08-05 15:44:16 +02:00
parent feb15cc63c
commit 5a9212d612
4 changed files with 17 additions and 8 deletions
@@ -539,7 +539,7 @@ NFS4Inode::OpenFile(OpenState* state, int mode)
ReplyInterpreter& reply = request.Reply(); ReplyInterpreter& reply = request.Reply();
if (HandleErrors(reply.NFS4Error(), serv)) if (HandleErrors(reply.NFS4Error(), serv, NULL, state))
continue; continue;
// Verify if the file we want to open is the file this Inode // Verify if the file we want to open is the file this Inode
@@ -592,7 +592,7 @@ NFS4Inode::ReadFile(OpenFileCookie* cookie, OpenState* state, uint64 position,
ReplyInterpreter& reply = request.Reply(); ReplyInterpreter& reply = request.Reply();
if (HandleErrors(reply.NFS4Error(), serv, cookie)) if (HandleErrors(reply.NFS4Error(), serv, cookie, state))
continue; continue;
reply.PutFH(); reply.PutFH();
@@ -625,7 +625,7 @@ NFS4Inode::WriteFile(OpenFileCookie* cookie, OpenState* state, uint64 position,
ReplyInterpreter& reply = request.Reply(); ReplyInterpreter& reply = request.Reply();
if (HandleErrors(reply.NFS4Error(), serv, cookie)) if (HandleErrors(reply.NFS4Error(), serv, cookie, state))
continue; continue;
reply.PutFH(); reply.PutFH();
@@ -15,7 +15,7 @@
bool bool
NFS4Object::HandleErrors(uint32 nfs4Error, RPC::Server* serv, NFS4Object::HandleErrors(uint32 nfs4Error, RPC::Server* serv,
OpenFileCookie* cookie) OpenFileCookie* cookie, OpenState* state)
{ {
uint32 leaseTime; uint32 leaseTime;
@@ -62,8 +62,14 @@ NFS4Object::HandleErrors(uint32 nfs4Error, RPC::Server* serv,
// server has rebooted, reclaim share and try again // server has rebooted, reclaim share and try again
case NFS4ERR_STALE_CLIENTID: case NFS4ERR_STALE_CLIENTID:
case NFS4ERR_STALE_STATEID: case NFS4ERR_STALE_STATEID:
fFileSystem->NFSServer()->ServerRebooted(cookie->fClientID); if (cookie != NULL) {
return true; fFileSystem->NFSServer()->ServerRebooted(cookie->fClientID);
return true;
} else if (state != NULL) {
fFileSystem->NFSServer()->ServerRebooted(state->fClientID);
return true;
}
return false;
// FileHandle has expired // FileHandle has expired
case NFS4ERR_FHEXPIRED: case NFS4ERR_FHEXPIRED:
@@ -82,6 +88,9 @@ NFS4Object::HandleErrors(uint32 nfs4Error, RPC::Server* serv,
if (cookie != NULL) { if (cookie != NULL) {
fFileSystem->NFSServer()->ClientId(cookie->fClientID, true); fFileSystem->NFSServer()->ClientId(cookie->fClientID, true);
return true; return true;
} else if (state != NULL) {
fFileSystem->NFSServer()->ClientId(state->fClientID, true);
return true;
} }
return false; return false;
@@ -19,7 +19,7 @@ class OpenState;
class NFS4Object { class NFS4Object {
public: public:
bool HandleErrors(uint32 nfs4Error, RPC::Server* serv, bool HandleErrors(uint32 nfs4Error, RPC::Server* serv,
OpenFileCookie* cookie = NULL); OpenFileCookie* cookie = NULL, OpenState* state = NULL);
status_t ConfirmOpen(const FileHandle& fileHandle, OpenState* state); status_t ConfirmOpen(const FileHandle& fileHandle, OpenState* state);
@@ -101,7 +101,7 @@ OpenState::Close()
ReplyInterpreter& reply = request.Reply(); ReplyInterpreter& reply = request.Reply();
if (HandleErrors(reply.NFS4Error(), serv)) if (HandleErrors(reply.NFS4Error(), serv, NULL, this))
continue; continue;
reply.PutFH(); reply.PutFH();