Commit Graph

61 Commits

Author SHA1 Message Date
Gu Zhongyan
de2ddf9a8b rados: clean up rados_getxattrs() and rados_striper_getxattrs()
Signed-off-by: Gu Zhongyan <guzhongyan@360.cn>
2018-02-02 17:34:13 +08:00
Kefu Chai
75c5e5cc26 cmake: pass static linkflags to the linker who links libcommon
Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-01-04 19:44:04 +08:00
songweibin
38f909c9cd libradosstriper: silence warning from -Wreorder
Signed-off-by: songweibin <song.weibin@zte.com.cn>
2017-08-08 16:35:22 +08:00
amitkuma
6ab618f7e7 rado: Initilizating uninitilized member m_writeRc
Fixes the Coverity Scan Report:

** 1414521 Uninitialized scalar field
CID 1414521 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
3. uninit_member: Non-static class member m_writeRc is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Amit Kumar amitkuma@redhat.com
2017-08-03 21:09:59 +05:30
Kefu Chai
2d4aabf2f2 Merge pull request #15674 from chardan/jfw-wip-20240-printf-format
libradosstriper: fix format injection vulnerability

Reviewed-by: Kefu Chai <kchai@redhat.com>
2017-07-18 01:08:55 +08:00
Jesse Williamson
e94d3b9661 libradosstriper: remove format injection vulnerability
Fixes: http://tracker.ceph.com/issues/20240

Signed-off-by: Stan K <redrampage@selectel.ru>
2017-06-19 15:08:59 -07:00
Kefu Chai
02fba1246f radosstriper: assert(ref==1) in MultiAioCompletion's dtor
Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-06-05 14:07:08 +08:00
Kefu Chai
b7e9373358 radosstriper: use intrusive_ptr to manage lifecycle of MultiAioCompletionImpl
this change also silence some cppcheck warnings: we fail to rlease
references to MultiAioCompletionImpl in some of the error handling paths.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-06-05 14:07:08 +08:00
Sage Weil
6b6c14f8c7 Merge pull request #14658 from chardan/jfw-wip-halflife_atomic_t-baragon
librados,libradosstriper,test: migrate atomic_t to std::atomic (baragon)

Reviewed-by: Sage Weil <sage@redhat.com>
2017-05-25 22:29:19 -05:00
Kefu Chai
6fbcac46a3 Merge pull request #15012 from tchaikov/wip-byteswap
byteorder: use gcc intrinsics for byteswap

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
Reviewed-by: Casey Bodley <cbodley@redhat.com>
Reviewed-by: Sage Weil <sage@redhat.com>
2017-05-12 19:40:02 +08:00
Kefu Chai
c44cdc27d5 radosstriper: do not use GCC extension to initialize struct members
it's obsolete since GCC 2.5 and is not portable. see
https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html

Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-05-10 23:12:30 +08:00
Jesse Williamson
646234fb26 libradosstriper: remove references to atomic.h
Signed-off-by: Jesse Williamson <jwilliamson@suse.de>
2017-05-10 07:41:02 -07:00
Kefu Chai
8bbafd2859 libradosstriper: do not assign garbage to returned value
if `rc` is not zero, the returned `ssize` is either garbage or
undefined. this silences warning from clang analyzer:

Assigned value is garbage or undefined

Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-05-10 10:31:57 +08:00
liuchang0812
905007c588 librados: add override in headers
Signed-off-by: liuchang0812 <liuchang0812@gmail.com>
2017-03-03 19:40:49 +08:00
Danny Al-Gaaf
ce5493cab0 RadosStriperImpl.cc: fix double free
Some variables have been already free'd by calling
release(), no need to call delete() again on them.

CID 1396200 (#1 of 1): Double free (USE_AFTER_FREE)
 double_free: Calling operator delete frees pointer
 getxattr_completion which has already been freed.
CID 1396206 (#1 of 1): Double free (USE_AFTER_FREE)
 double_free: Calling operator delete frees pointer
 getxattr_completion which has already been freed.
CID 1396214 (#1 of 1): Double free (USE_AFTER_FREE)
 double_free: Calling operator delete frees pointer
 stat_completion which has already been freed.
CID 1396218 (#1 of 1): Double free (USE_AFTER_FREE)
 double_free: Calling operator delete frees pointer
 stat_completion which has already been freed.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2017-02-08 21:54:25 -05:00
Kefu Chai
8f7643792c cmake: turn libcommon into a shared library
prior to this change, libcommon is a convenient library which gets
linked into librados, librbd and libcephfs and all ceph executables.
this incurs some problems:
 - double dose of libcommon in memory space and HDD: waste of memory
   and disk space.
 - if an application links to two libraries including libcommon at the
   same time. take librados and libcephfs as an example, they could
   interfere with each other by changing the other guy's status.
after this change, libcommon is tuned into a shared library and
renamed to libceph-common. it will be installed into $prefix/lib/ceph,
and packaged in librados2.

ceph.spec.in,debian/librados2.install: package libceph-common in
  librados2.
CMakeLists.txt:
  - do not link against libboost-* if not necessary.
  - s/common/ceph-common/g
  - install libceph-common into $prefix/lib/ceph
  - set rpath to $prefix/lib/ceph
  - link against ceph-common if an executable needs access to non public
    symbols in ceph.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-01-10 21:10:53 +08:00
Sage Weil
af01db76f6 librados: eliminiate ack vs commit distinction
- paper over the distinction in the public interface
- consolidate internal completions and flags

Signed-off-by: Sage Weil <sage@redhat.com>
2016-12-28 17:01:26 -05:00
Sebastien Ponce
db2f521956 radosstriper : Fixed locking of truncation in libradosstriper
Last commit did drop the check for existence of the object. It's now back there

Signed-off-by: Sebastien Ponce <sebastien.ponce@cern.ch>
2016-11-01 16:37:12 +01:00
Sebastien Ponce
64bb74ab94 radosstriper : Reworked handling of unlocking completion in striper library
Previous implementation was not always making sure that unlocking completed and this could lead to not unlocking at all in case the process wsa exiting before the Objecter did handle the async unlock request.

Signed-off-by: Sebastien Ponce <sebastien.ponce@cern.ch>
2016-11-01 16:37:04 +01:00
Sebastien Ponce
412ee3adcd radosstriper : Fixed memory leaks found in valgrind testing of (improved) striper library
Signed-off-by: Sebastien Ponce <sebastien.ponce@cern.ch>
2016-11-01 16:36:26 +01:00
Sebastien Ponce
cf5b105779 radosstriper : implementation of async remove/stat/stat2
This completes the asynchronous API of libradosstriper for stats and remove

Signed-off-by: Sebastien Ponce <sebastien.ponce@cern.ch>
2016-11-01 16:36:05 +01:00
Sebastien Ponce
4b09a84412 radosstriper : proper calls to static function aio_create_completion
This was so far called as if it was not static

Signed-off-by: Sebastien Ponce <sebastien.ponce@cern.ch>
2016-11-01 16:36:05 +01:00
Sebastien Ponce
41d9dd626e radosstriper : prefer asynchronous unlock to synchronous ones
Usage of synchronous unlock in the completion callbacks was found to be a limitation for heavy parallel transfers sharing a single IoCtx

Signed-off-by: Sebastien Ponce <sebastien.ponce@cern.ch>
2016-11-01 16:36:05 +01:00
Sebastien Ponce
7cce1e8c51 radosstriper : protect aio_write API from calls with 0 bytes
an assertion was failing so far, while we only have to return without doing anything

Signed-off-by: Sebastien Ponce <sebastien.ponce@cern.ch>
2016-11-01 16:36:05 +01:00
Sebastien Ponce
7a50ea479e radosstriper : optimized truncation and removal of striped objects
striped objects' truncation and removal is now using the rados asynchronous APIs and taking benefit of the parallelization they allow.
So far, the different rados objects inside a striped object where removed one by one via synchronous calls, and it was typically taking ages for big ones.

Signed-off-by: Sebastien Ponce <sebastien.ponce@cern.ch>
2016-11-01 16:36:05 +01:00
Sage Weil
fba798dcad remove autotools
Signed-off-by: Sage Weil <sage@redhat.com>
2016-09-07 11:50:14 -04:00
Kefu Chai
c8fe1782a6 cmake: move librados.cc out of libradosstriper
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>
2016-06-29 22:26:25 +08:00
Kefu Chai
659ce77875 cmake: link libradostriper with librados_objs
create an OBJECT target for libradostriper, so it is able to access the
internal symbols of librados.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-06-23 15:23:59 +08:00
Kefu Chai
1b2fd2b3eb cmake: remove visibility flags from libcephfs,libradosstriper
because libradosstriper does not put the `__attribute__ ((visibility
("default")))` specifier on the exported class/methods. we cannot
add the visibility to this library yet. the same applies to libcephfs.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-06-23 15:23:58 +08:00
Kefu Chai
4d3de44385 cmake: use ${CEPH_SHARED} when adding libradosstriper
Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-06-22 23:21:46 +08:00
Kefu Chai
0d727dbf7b cmake: install dso into ${CMAKE_INSTALL_LIBDIR} instead of "lib"
Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-06-22 11:30:46 +08:00
Kefu Chai
c7f8b8558f cmake: add visibility flags for exported dso
* no regression found, and there's a substantial reduction in the size of
  generated librados library (both stripped and not).
* also remove the duplicated set_target_properties(librbd...) command

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-06-22 11:30:46 +08:00
Kefu Chai
8588e3d55e cmake: libradosstriper's OUTPUT_NAME should be radosstriper
and s/libradosstriper/radosstriper/ otherwise the created .so
filename would be liblibradosstriper.so with the default prefix.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-06-01 23:49:46 +08:00
Kefu Chai
5800bea33c cmake: install libradosstriper headers
also respect BUILD_SHARED_LIBS instead of always building this lib as a
static library. and we install .so in rpm/deb packaging scripts.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-05-28 00:09:32 +08:00
Sage Weil
99f1f6478d struct ceph_file_layout -> file_layout_t
- drop the global
- do not memset!
- encode with features
- field names are different
- use get_period() method where appropriate
- fix is layout empty checks

Signed-off-by: Sage Weil <sage@redhat.com>
2016-03-01 11:18:16 -05:00
Sage Weil
162ca5bcf9 libradosstriper: move default stripe parameters inline
The extern is going away.

Signed-off-by: Sage Weil <sage@redhat.com>
2016-03-01 11:17:00 -05:00
Jianpeng Ma
ed54420e21 bufferlist: Add new func is_provided_buffer(const char *dst)
Using this function to judge whether copy data from bufferlist to
dst. It mainly used librados C interface to avoid copy data from librados
to caller.

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
2016-02-20 14:15:17 +08:00
Ali Maredia
68c3b3390e cmake: libradosstriper dir CMakeLists.txt added
Signed-off-by: Ali Maredia <amaredia@redhat.com>
2016-01-05 15:42:06 -05:00
shawn
54a6ba8c4b rados: implement radosstripper force remove when full.
extend libradosstripper remove interface and rados tool
                    rm force-full when use_stripper.

Signed-off-by: Xiaowei Chen <chen.xiaowei@h3c.com>
2015-12-11 03:47:30 -05:00
Kefu Chai
8e8d529fb3 Merge pull request #4955 from kylinstorage/librados-2read-segmentation-fault-v1
bug fix: librados segmentation fault, when two read ops share one Aio…

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
2015-09-09 12:45:01 +08:00
Min Chen
dbfac2807c bug fix: librados segmentation fault, support RadosStriperImpl::aio_read() method
Signed-off-by: Min Chen <minchen@ubuntukylin.com>
2015-08-31 15:09:58 +08:00
Sebastien Ponce
e4c27d8048 tests : Fixed broken Makefiles after integration of lttng into rados.
The symbols of lttng were exposed twice leading to error when launching executables using libradosstriper.

Signed-off-by: Sebastien Ponce <sebastien.ponce@cern.ch>
2015-06-23 13:04:22 +02:00
Kefu Chai
9da1d1f52e Merge pull request #4150 from javierguerragiraldez/master
libradosstriper: declare libradosstriper library dependencies

Reviewed-by: Kefu Chai <kchai@redhat.com>
2015-03-24 20:48:00 +08:00
Javier Guerra
7413cd7f40 Declare libradosstriper library dependencies
When omitted, trying to dynamically load libradosstriper results in "undefined symbol" errors.

Signed-off-by: Javier Guerra <javier@guerrag.com>
2015-03-23 17:44:31 -05:00
Sage Weil
d26a9dce5e Merge remote-tracking branch 'gh/hammer'
Conflicts:
	PendingReleaseNotes
	src/Makefile.am
	src/gmock
	src/test/Makefile.am
2015-03-19 12:41:04 -07:00
Boris Ranto
96c685ee8f Minor changes in other Makefile.am files to make them support the build refinement 2015-03-06 15:19:53 +01:00
Kefu Chai
52e87d3214 msg/xio: fix build with '--enable-xio'
* do not hide the symbols in buffer.cc, as XioMessenger.cc is referencing
  get_xio_mp().
* do not export private symbols from libcephfs.

Fixes: #10735
Co-authored-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Signed-off-by: Kefu Chai <kchai@redhat.com>
2015-02-27 11:00:17 +08:00
Sebastien Ponce
6a91f2bb82 libradosstriper: fixed write_full when ENOENT
Fixes: #10758
write_full was returning ENOENT when the file did not exists, while it should just have created it without complaining.

Signed-off-by: Sebastien Ponce <sebastien.ponce@cern.ch>
2015-02-06 09:08:35 +01:00
Dongmao Zhang
78a15ee4c6 Fix libstriprados::remove, use strtoll insdead of strtol
Signed-off-by: Dongmao Zhang <deanraccoon@gmail.com>
2014-12-10 18:55:55 +08:00
Jason Dillaman
dbb5a48e4a librados: Only public API symbols from the shared library
The librados shared library was previously exporting all
symbols.  librados public API methods are now explicitly
exported and all other symbols are hidden.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2014-11-26 16:53:46 -05:00