From aa5a8cb346abcd13bd7c401f2e82153b661235e3 Mon Sep 17 00:00:00 2001 From: Pawel Dziepak Date: Mon, 24 Dec 2012 20:27:07 +0100 Subject: [PATCH] nfs4: Add assertions for unexpected error codes There are some NFS4 error codes we should not get if the client is operating correctly. CLID_INUSE may be caused only by incorrectly generated SETCLIENTID request. NOFILEHANDLE, RESTOREFH and OP_ILLEGAL indicate that the client has sent an incorrectly build request. BAD_STATEID and BAD_SEQID indicate a bug in handling {open,lock}_owners. LOCK_HELD happens when the client incorrectly cleans up after accessing a file. --- src/add-ons/kernel/file_systems/nfs4/NFS4Object.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/add-ons/kernel/file_systems/nfs4/NFS4Object.cpp b/src/add-ons/kernel/file_systems/nfs4/NFS4Object.cpp index c4949a4511..f13d34eb39 100644 --- a/src/add-ons/kernel/file_systems/nfs4/NFS4Object.cpp +++ b/src/add-ons/kernel/file_systems/nfs4/NFS4Object.cpp @@ -20,6 +20,15 @@ NFS4Object::HandleErrors(uint32 nfs4Error, RPC::Server* serv, { uint32 leaseTime; + // No request send by the client should cause any of the following errors. + ASSERT(nfs4Error != NFS4ERR_CLID_INUSE); + ASSERT(nfs4Error != NFS4ERR_NOFILEHANDLE); + ASSERT(nfs4Error != NFS4ERR_BAD_STATEID); + ASSERT(nfs4Error != NFS4ERR_BAD_SEQID); + ASSERT(nfs4Error != NFS4ERR_RESTOREFH); + ASSERT(nfs4Error != NFS4ERR_LOCK_HELD); + ASSERT(nfs4Error != NFS4ERR_OP_ILLEGAL); + if (cookie != NULL) state = cookie->fOpenState;