]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: move librados.cc out of libradosstriper
authorKefu Chai <kchai@redhat.com>
Wed, 29 Jun 2016 06:47:52 +0000 (14:47 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 29 Jun 2016 14:26:25 +0000 (22:26 +0800)
NObjectIterator::__EndObjectIterator is a static member variable
whose destructor deletes a pointer. librados.cc is the source file that
defines __EndObjectIterator. before this change rados cli is linked
against libradosstriper and librados. both of them include librados.cc.
that's why the dtor is called twice, hence double free when the dso
is closed and the static variables are destructed. in this change,
the librados.cc is moved out of libradosstriper, RadosClient.cc,
RadosXattrIter.cc and IoCtxImpl.cc kept as the OBJECT library, as
libradostriper is accessing the non-public symbols defined by them.

Fixes: http://tracker.ceph.com/issues/16504
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/CMakeLists.txt
src/libradosstriper/CMakeLists.txt

index 9ff15d92d0fd969b735fd6b7d0c7d326364c975c..a5519fe4b64a70a4f5f6589ac13ea1c8a275d638 100644 (file)
@@ -554,20 +554,18 @@ add_library(osdc_rbd_objs OBJECT ${osdc_rbd_files})
 add_library(osdc STATIC ${osdc_files} $<TARGET_OBJECTS:osdc_rbd_objs>)
 
 add_library(rados_snap_set_diff_obj OBJECT librados/snap_set_diff.cc)
-set(librados_srcs
-  librados/librados.cc
-  librados/RadosClient.cc
+add_library(librados_objs OBJECT
   librados/IoCtxImpl.cc
   librados/RadosXattrIter.cc
-  )
-add_library(librados_objs OBJECT ${librados_srcs})
+  librados/RadosClient.cc)
 add_library(librados ${CEPH_SHARED}
-  $<TARGET_OBJECTS:librados_objs>
+  librados/librados.cc
   $<TARGET_OBJECTS:cls_references_objs>
-  $<TARGET_OBJECTS:common_util_obj>)
+  $<TARGET_OBJECTS:common_util_obj>
+  $<TARGET_OBJECTS:librados_objs>)
 add_dependencies(librados osdc)
 if(WITH_LTTNG)
-  add_dependencies(librados_objs rados-tp)
+  add_dependencies(librados rados-tp)
 endif()
 # LINK_PRIVATE instead of PRIVATE is used to backward compatibility with cmake 2.8.11
 target_link_libraries(librados LINK_PRIVATE osdc osd os global common cls_lock_client
index d93d03f0579efed8a6a300c954d39eb82b9b5575..35b64ffbfdda532c339d06328ad19272835afcc9 100644 (file)
@@ -5,7 +5,7 @@ set(libradosstriper_srcs
 add_library(radosstriper ${CEPH_SHARED}
   ${libradosstriper_srcs}
   $<TARGET_OBJECTS:librados_objs>)
-target_link_libraries(radosstriper cls_lock_client osdc common pthread ${CRYPTO_LIBS} ${EXTRALIBS})
+target_link_libraries(radosstriper librados cls_lock_client osdc common pthread ${CRYPTO_LIBS} ${EXTRALIBS})
 set_target_properties(radosstriper PROPERTIES
   OUPUT_NAME radosstriper
   VERSION 1.0.0