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.
This commit is contained in:
Pawel Dziepak
2013-01-08 23:10:56 +01:00
parent bd19f23cec
commit 9f12d1353a
@@ -186,8 +186,10 @@ OpenState::_ReclaimOpen(uint64 newClientID)
sequence += IncrementSequence(reply.NFS4Error()); 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; continue;
}
reply.PutFH(); reply.PutFH();
@@ -250,8 +252,12 @@ OpenState::_ReclaimLocks(uint64 newClientID)
sequence += IncrementSequence(reply.NFS4Error()); 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; continue;
}
reply.PutFH(); reply.PutFH();
reply.Lock(linfo); reply.Lock(linfo);