From: Sage Weil Date: Sat, 19 Jul 2014 20:24:21 +0000 (-0700) Subject: os/MemStore: fix wrlock ordering checks X-Git-Tag: v0.84~78^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8dd6b8f9d8d5451335a73c045ce913f27ec55f44;p=ceph.git os/MemStore: fix wrlock ordering checks We can't compare the shared_ptrs themselves; we need to compare the addresses of the actual objects. Signed-off-by: Sage Weil --- diff --git a/src/os/MemStore.cc b/src/os/MemStore.cc index c1af61733353..0491b5abe692 100644 --- a/src/os/MemStore.cc +++ b/src/os/MemStore.cc @@ -1351,8 +1351,8 @@ int MemStore::_collection_add(coll_t cid, coll_t ocid, const ghobject_t& oid) CollectionRef oc = get_collection(ocid); if (!oc) return -ENOENT; - RWLock::WLocker l1(MIN(c, oc)->lock); - RWLock::WLocker l2(MAX(c, oc)->lock); + RWLock::WLocker l1(MIN(&(*c), &(*oc))->lock); + RWLock::WLocker l2(MAX(&(*c), &(*oc))->lock); if (c->object_hash.count(oid)) return -EEXIST; @@ -1475,8 +1475,8 @@ int MemStore::_split_collection(coll_t cid, uint32_t bits, uint32_t match, CollectionRef dc = get_collection(dest); if (!dc) return -ENOENT; - RWLock::WLocker l1(MIN(sc, dc)->lock); - RWLock::WLocker l2(MAX(sc, dc)->lock); + RWLock::WLocker l1(MIN(&(*sc), &(*dc))->lock); + RWLock::WLocker l2(MAX(&(*sc), &(*dc))->lock); map::iterator p = sc->object_map.begin(); while (p != sc->object_map.end()) {