1. Reserved space is not released unless we call cleanupBlock(). Yes its good point to verify double release . I have updated the test case to assert this case. Please correct me if still you feel some other call is clearing space.
Thanks for pointing out that, bytesReserved is resetting to 0 in releaseAllBytesReserved, then double calls wont harm.
I think the following change need not required and this will not reset the value of bytesReserved in replicainfo. Instead, calling replicaInfo.releaseAllBytesReserved(); will make sure everything reset. It would be better to unify this call everywhere.
+ FsVolumeImpl v = (FsVolumeImpl)replicaInfo.getVolume();
One more place replicaInfo.releaseAllBytesReserved(); call required is the BlockReceiver's constructor on exception. This will make sure reserved space is cleared even after some other exception during creation of block ( either rbw or tmp).
It would be better if more tests can be added to verify these corner cases.