]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
librbd/cache/pwl:fix clean vs bytes_dirty cache state inconsistency 49054/head
authorYin Congmin <congmin.yin@intel.com>
Wed, 19 Oct 2022 02:47:35 +0000 (10:47 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Fri, 25 Nov 2022 11:07:47 +0000 (12:07 +0100)
commitb35de88a3a7d7e3498a939264566dcca44ff1cfa
tree68cc2ff09b59f9c7a86dcd81d9563ac196f028d7
parent78cde95d3d87171b8a5f66fe6889d592245fc72a
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 ]
src/librbd/cache/pwl/AbstractWriteLog.cc