librbd/cache/pwl:fix clean vs bytes_dirty cache state inconsistency
The space of the pwl is pre allocated. In check_allocation(), the space
is reserved, and then the op is completed after a period of process.
When checking resource is successful and the resource is reserved,
dirty_bytes has been increased. But new entry will not be added
to m_dirty_log_entries until the op is finished. This time gap
leads to inconsistencies.
Put update_image_cache_state() in check_allocation() to fix this
issue. It is now considered that as long as space is reserved
and the op is started, the cache is dirty.
Fixes: https://tracker.ceph.com/issues/57872
Signed-off-by: Yin Congmin <congmin.yin@intel.com>
(cherry picked from commit
e2b079137473d4c819d58ef6466450a5c4a8b8af)
Conflicts:
src/librbd/cache/pwl/AbstractWriteLog.cc [ commit
6290446b819b
("librbd/cache/pwl/: remove IO waited state") not in pacific ]