From c8c205fa73078c1ee46152ed860084a272867f5e Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 1 Sep 2011 13:14:11 -0700 Subject: [PATCH] objectcacher: write vs truncate races are ok It is possible to write a buffer, truncate it away, and then not have it when we get the commit. Fixes: #1467 Signed-off-by: Sage Weil --- src/osdc/ObjectCacher.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osdc/ObjectCacher.cc b/src/osdc/ObjectCacher.cc index 19ef1224b57c1..a4dad0ddf1aca 100644 --- a/src/osdc/ObjectCacher.cc +++ b/src/osdc/ObjectCacher.cc @@ -632,7 +632,6 @@ void ObjectCacher::bh_write_commit(int64_t poolid, sobject_t oid, loff_t start, << dendl; if (objects[poolid].count(oid) == 0) { ldout(cct, 7) << "bh_write_commit no object cache" << dendl; - assert(0); } else { Object *ob = objects[poolid][oid]; @@ -642,7 +641,8 @@ void ObjectCacher::bh_write_commit(int64_t poolid, sobject_t oid, loff_t start, p++) { BufferHead *bh = p->second; - if (bh->start() > start+(loff_t)length) break; + if (bh->start() > start+(loff_t)length) + break; if (bh->start() < start && bh->end() > start+(loff_t)length) { -- 2.39.5