From: Jianpeng Ma Date: Fri, 6 Feb 2015 01:53:36 +0000 (+0800) Subject: osdc: For trust_enoent is true, there is only one extent. X-Git-Tag: v9.0.0~185^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2449fddc13b5ce8bbf1bb4ecaa5d6937f54e54d1;p=ceph.git osdc: For trust_enoent is true, there is only one extent. Now the judgement only in conditon which will return -ENOENT. But o->exists don't depend on the extent size. It only depend on trust_enoent. So move this judgement at the first of _readx(). Make this bug ASAP occur. Signed-off-by: Jianpeng Ma --- diff --git a/src/osdc/ObjectCacher.cc b/src/osdc/ObjectCacher.cc index f2b7e955430c..eef961ff560a 100644 --- a/src/osdc/ObjectCacher.cc +++ b/src/osdc/ObjectCacher.cc @@ -1060,6 +1060,13 @@ int ObjectCacher::_readx(OSDRead *rd, ObjectSet *oset, Context *onfinish, map stripe_map; // final buffer offset -> substring bool dontneed = rd->fadvise_flags & LIBRADOS_OP_FLAG_FADVISE_DONTNEED; + /* + * WARNING: we can only meaningfully return ENOENT if the read request + * passed in a single ObjectExtent. Any caller who wants ENOENT instead of + * zeroed buffers needs to feed single extents into readx(). + */ + assert(!oset->return_enoent || rd->extents.size() == 1); + for (vector::iterator ex_it = rd->extents.begin(); ex_it != rd->extents.end(); ++ex_it) { @@ -1075,10 +1082,6 @@ int ObjectCacher::_readx(OSDRead *rd, ObjectSet *oset, Context *onfinish, // does not exist and no hits? if (oset->return_enoent && !o->exists) { - // WARNING: we can only meaningfully return ENOENT if the read request - // passed in a single ObjectExtent. Any caller who wants ENOENT instead of - // zeroed buffers needs to feed single extents into readx(). - assert(rd->extents.size() == 1); ldout(cct, 10) << "readx object !exists, 1 extent..." << dendl; // should we worry about COW underneaeth us?