From: Alex Ainscow Date: Thu, 24 Apr 2025 13:02:41 +0000 (+0100) Subject: osd: clone + delete ops should invalidate source new EC extent cache. X-Git-Tag: v20.1.0~68^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fb2d50c30ab75a0b19aa390e9271485cadd172fb;p=ceph.git osd: clone + delete ops should invalidate source new EC extent cache. The op.is_delete() function only returns true if the op is not ALSO doing something else (e.g. a clone). This causes issues with clearing the new EC extent cache. Also improve some debug and code cleanliness. Signed-off-by: Alex Ainscow (cherry picked from commit 1224063e8f9b6fcafcba399373a43f0bc7488bcc) --- diff --git a/src/osd/ECExtentCache.cc b/src/osd/ECExtentCache.cc index bbd7aa5e4271..b5c7e7636f24 100644 --- a/src/osd/ECExtentCache.cc +++ b/src/osd/ECExtentCache.cc @@ -330,10 +330,6 @@ void ECExtentCache::on_change2() const { void ECExtentCache::execute(list &op_list) { for (auto &op : op_list) { - if (op->projected_size < op->object.projected_size) { - // Invalidate the object's cache when we see any object reduce in size. - op->invalidates_cache = true; - } op->object.request(op); } waiting_ops.insert(waiting_ops.end(), op_list.begin(), op_list.end()); diff --git a/src/osd/ECTransaction.cc b/src/osd/ECTransaction.cc index e931e6cfbd61..d727f721de22 100644 --- a/src/osd/ECTransaction.cc +++ b/src/osd/ECTransaction.cc @@ -137,7 +137,12 @@ ECTransaction::WritePlanObj::WritePlanObj( { extent_set unaligned_ro_writes; hobject_t source; - invalidates_cache = op.has_source(&source) || op.is_delete(); + /* Certain transactions mean that the cache is invalid: + * 1. Clone operations invalidate the *target* + * 2. ALL delete operations (do NOT use is_delete() here!!!) + * 3. Truncates that reduce size. + */ + invalidates_cache = op.has_source(&source) || op.delete_first || projected_size < orig_size; op.buffer_updates.to_interval_set(unaligned_ro_writes);