mirror of
https://github.com/versity/scoutfs.git
synced 2026-02-09 04:00:10 +00:00
The stale block handling code only handled the case where we read through a stale root into blocks that have been overwritten in the persistent store. In this case you'll get a new root and the read will be OK. It didn't handle the case where we have stale blocks cached at the blocks of the legitamate current root. In this case we get ESTALE from each stale block and because the root doesn't change when we retry we assume the persistent structure is corrupt. This case can happen when the btree ring wraps and there are still blocks cached at the head of the ring. This became much more possible when we moved to small fixed size keys. The fix is to retry reading individual blocks or segments before returning -ESTALE and expecting the caller to get a new root and try again. In the stale cache case this will allow the more recent correct blocks to be read. Signed-off-by: Zach Brown <zab@versity.com>