From 9f12d1353a279af30633d591d85733b8f44257c0 Mon Sep 17 00:00:00 2001 From: Pawel Dziepak Date: Tue, 8 Jan 2013 23:03:51 +0100 Subject: [PATCH] nfs4: Prevent OpenState::_ReclaimLocks from being called recursively When server reboots again when share reservations or locks are being reclaimed there is a risk that HandleErrors will invoke Reclaim(( again making it crash due to some double locks and more importantly making these two attempts to reclaim resources conflict and cause some much harder to recover from server errors. Instead all that, when server is rebooted again while recovering from previous reboot the recovery is aborted, the client retries its original request and then proper recovery occurs completly on a new server instance. --- src/add-ons/kernel/file_systems/nfs4/OpenState.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/add-ons/kernel/file_systems/nfs4/OpenState.cpp b/src/add-ons/kernel/file_systems/nfs4/OpenState.cpp index 7ae795e779..21ac8d5b78 100644 --- a/src/add-ons/kernel/file_systems/nfs4/OpenState.cpp +++ b/src/add-ons/kernel/file_systems/nfs4/OpenState.cpp @@ -186,8 +186,10 @@ OpenState::_ReclaimOpen(uint64 newClientID) sequence += IncrementSequence(reply.NFS4Error()); - if (HandleErrors(reply.NFS4Error(), server, NULL, NULL, &sequence)) + if (reply.NFS4Error() != NFS4ERR_STALE_CLIENTID + && HandleErrors(reply.NFS4Error(), server, NULL, NULL, &sequence)) { continue; + } reply.PutFH(); @@ -250,8 +252,12 @@ OpenState::_ReclaimLocks(uint64 newClientID) sequence += IncrementSequence(reply.NFS4Error()); - if (HandleErrors(reply.NFS4Error(), server, NULL, NULL, &sequence)) + if (reply.NFS4Error() != NFS4ERR_STALE_CLIENTID + && reply.NFS4Error() != NFS4ERR_STALE_STATEID + && HandleErrors(reply.NFS4Error(), server, NULL, NULL, + &sequence)) { continue; + } reply.PutFH(); reply.Lock(linfo);