From: Yin Congmin Date: Thu, 18 Mar 2021 13:33:07 +0000 (+0800) Subject: librbd/cache/pwl: fix bug of flush request blocked by deferd IO X-Git-Tag: v16.2.0~52^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F40339%2Fhead;p=ceph.git librbd/cache/pwl: fix bug of flush request blocked by deferd IO Flush requests do not need to be queued behind the defer_io queue, should be issued immediately. Otherwise, there will be a deadlock scenario in which dirty data is waiting for flush req, flush req is waiting for defer_io empty, and defer_io is waiting for dirty data persistence to release space. So this sometimes occur when the cache is small but the IO is large or the queue depth is large. Signed-off-by: Yin Congmin (cherry picked from commit 6583182f624386bfbb7375fb227dfb77b0a3209d) --- diff --git a/src/librbd/cache/pwl/AbstractWriteLog.cc b/src/librbd/cache/pwl/AbstractWriteLog.cc index a658b60b2fe4..76e8e478e2bf 100644 --- a/src/librbd/cache/pwl/AbstractWriteLog.cc +++ b/src/librbd/cache/pwl/AbstractWriteLog.cc @@ -818,9 +818,11 @@ void AbstractWriteLog::write(Extents &&image_extents, ceph_assert(m_initialized); - /* Split images because PMDK doesn't support allocating too big extent - * TODO: If the bluestore allocator is implemented as a library, - * the split operation is not necessary + /* Split images because PMDK's space management is not perfect, there are + * fragment problems. The larger the block size difference of the block, + * the easier the fragmentation problem will occur, resulting in the + * remaining space can not be allocated in large size. We plan to manage + * pmem space and allocation by ourselves in the future. */ Extents split_image_extents; uint64_t max_extent_size = get_max_extent(); @@ -1430,6 +1432,11 @@ void AbstractWriteLog::alloc_and_dispatch_io_req(C_BlockIORequestT *req) { std::lock_guard locker(m_lock); dispatch_here = m_deferred_ios.empty(); + // Only flush req's total_bytes is the max uint64 + if ((req->image_extents_summary.total_bytes == + std::numeric_limits::max())) { + dispatch_here = true; + } } if (dispatch_here) { dispatch_here = req->alloc_resources();