Commit Graph

737 Commits

Author SHA1 Message Date
Kefu Chai
80d0c9f1d2 src: use entity_addr_t::parse(string_view) when possible
for better readability

Signed-off-by: Kefu Chai <kchai@redhat.com>
2021-04-05 12:33:04 +08:00
Kefu Chai
c4d04b3013
Merge pull request #39322 from rzarzynski/wip-librados-nul-objname
librados, pybind, tests: allow to list objects with the NUL character in names

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
Reviewed-by: J. Eric Ivancich <ivancich@redhat.com>
2021-02-24 17:55:08 +08:00
Radoslaw Zarzynski
22bb1498c9 librados: NObjectIteratorImpl takes care about NUL in obj name.
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
2021-02-05 12:54:22 +00:00
Radoslaw Zarzynski
9d268b0dd7 librados: introduce rados_nobjects_list_next2().
It's needed to properly list an object with the NUL
character in the name. Such names can appear mostly
as a consequence of bugs in clients.

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
2021-02-05 12:53:37 +00:00
Sage Weil
a8bed67ad1 librados: set FULL_TRY flag on ioctx, not objecter
Signed-off-by: Sage Weil <sage@newdream.net>
2021-02-03 16:47:44 -05:00
Sage Weil
68564836ff librados/IoCtxImpl: pass extra_op_flags everywhere
Unused, so far...

Signed-off-by: Sage Weil <sage@newdream.net>
2021-02-03 16:47:43 -05:00
Lucian Petrut
5c008725db cmake,win32*.sh: Windows DLL support
At the moment, the Windows binaries can only be linked statically.
This is less than ideal since:

* the resulting binaries can be quite large, especially when
including debug symbols
* librados and librbd cannot be used directly by 3rd party apps
* the build duration is increased

In order to do a dynamic build, we'll:

* add an option to win32_build.sh
* fix link order
* dynamically link boost
* disable the "-pie" flag when using Mingw, which generates incorrect
  executable entry points
* by default, cmake generates import libs for executables. The issue
  is that for rados.exe, it generates librados.dll.a, thus overriding
  the librados.dll import library, which breaks the build process.
  We'll configure cmake to skip generating import libs for executables.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2021-01-26 08:41:51 +00:00
Lucian Petrut
2feed552d9 librados: avoid symbol versioning on Windows
symver isn't available on Windows. For now, we'll just pick the
default function version.

In the future, we may want to reconsider the versioning approach.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2021-01-06 12:14:14 +00:00
Kefu Chai
f88b410652 librados: move definition of cct_deleter to .cc
so cct->get() and cct->put() are visually closer. this improves the
readability.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2020-12-06 16:36:11 +08:00
Patrick Donnelly
0615f517cb
librados: initialize rados_mon_op_client
The timeout was not initialized with the current config value during
RadosClient construction.

Fixes a8a23747aa
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2020-11-30 14:00:58 -08:00
Patrick Donnelly
8c363d195a
librados: add RadosClient to conf observers
Commit 306eebe05b added the RadosClient to
the config observer interface but forgot to add it to the observer list.
This meant that the RadosClient was never receiving callbacks to
handle_conf_change. Commit a8a23747aa
exposed this issue because the mon timeout was configured at run-time.

Fixes: https://tracker.ceph.com/issues/48030
Fixes: a8a23747aa
Fixes: 306eebe05b
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2020-11-30 11:56:08 -08:00
Jason Dillaman
29ee772263 librados: workaround for boost::asio use of static member variables
boost::asio uses static member variables in a header-only library to
provide thread local storage. When boost::asio is used in multiple
independent shared libraries (e.g. librados and librbd), each module
will have its own version of the static variables and therefore will
cause inconsistencies when attempting to access the data.

Under GNU ELF extensions, static member variables are given global
unique symbol visibility. This was broken in librados due to the
symbol map, so manually export the static member variables so that
the dynamic linker can properly consolidate the variables.

See github.com boostorg/asio issue 150

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2020-11-16 18:16:11 -05:00
Patrick Donnelly
008eaca6c1
Merge PR #37529 into master
* refs/pull/37529/head:
	qa: set rados op timeouts for mds/ceph-fuse
	qa: print debug info on mount cleanup
	qa: remove redundant rmr
	qa: use null mode to prevent undesired changes to mountpoint
	qa: unmount all clients before deleting the file system
	osdc: add timeout configs for mons/osds
	common: accept timespan for SaferCond.wait_for

Reviewed-by: Neha Ojha <nojha@redhat.com>
Reviewed-by: Josh Durgin <jdurgin@redhat.com>
Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2020-10-19 19:26:52 -07:00
Changcheng Liu
dbdcb2535d common: remove log_early configuration option
After deciding to always enable tracking log in early phase, there's no
need to keep "log_early" option here and remove it directly.

Suggested-by: Kefu Chai <kefu@redhat.com>
Signed-off-by: Changcheng Liu <changcheng.liu@aliyun.com>
2020-10-19 14:30:28 +08:00
Patrick Donnelly
a8a23747aa
osdc: add timeout configs for mons/osds
Have the Objecter track the rados_(mon|osd)_op_timeout configs so that
it can be configured at runtime/startup. This is useful for the
MDS/ceph-fuse so that we can avoid waiting forever for a response from
the Monitors that will never come (statfs on a deleted file system's
pools).

Also: make these configs take a time value rather than double. This is
simpler to deal with in the code and allows time units to be used (e.g.
"5m" for 5 minutes).

Fixes: https://tracker.ceph.com/issues/47734
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2020-10-13 10:16:00 -07:00
Samuel Just
5d7d30f8e3
Merge pull request #37134 from myoungwon/wip-tier-evict
osd: add tier_evict

Reviewed-by: Samuel Just <sjust@redhat.com>
2020-10-05 23:06:21 -07:00
myoungwon oh
3e429a0362 osd: add tier_evict for manifest tier
Truncate the object size to 0 if the mainfest object is composed of chunks.

Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
2020-09-29 17:30:57 +09:00
Venky Shankar
310422b344 librados: API to decode notify message (bufferlist)
To keep consistency between the C and C++ APIs.

Signed-off-by: Venky Shankar <vshankar@redhat.com>
2020-09-17 00:29:52 -04:00
Venky Shankar
e3bd49f7b8 pybind/rados: introduce aio_notify() python binding
Signed-off-by: Venky Shankar <vshankar@redhat.com>
2020-09-17 00:29:52 -04:00
Patrick Donnelly
c27bf1ced2
Merge PR #35697 into master
* refs/pull/35697/head:
	doc: document cephfs mirroring developement status
	cephfs-mirror: cephfs-mirror daemon
	cephfs-mirror: FSMirror class to synchronize directory snaps
	common: introduce configuration options for cephfs-mirror daemon
	cephfs-mirror: InstanceWatcher class to register mirror instance
	cephfs-mirror: MirrorWatcher class to watch cephfs-mirror object
	cephfs-mirror: Watcher class to receive/ack watch notifications
	cephfs-mirror: ClusterWatcher class for watching peer changes
	librados: add API for fetching client addrs
	common: add cephfs_mirror subsystem
	cephfs-mirror: filesystem specification class

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
2020-09-01 13:24:59 -07:00
Samuel Just
4a73fd2251
Merge pull request #35899 from myoungwon/wip-fix-manifest-tier
osd, test: refactoring manfiest-tier

Reviewed-by: Samuel Just <sjust@redhat.com>
2020-09-01 12:49:57 -07:00
Venky Shankar
18c495f019 librados: add API for fetching client addrs
Signed-off-by: Venky Shankar <vshankar@redhat.com>
2020-09-01 06:58:10 -04:00
Patrick Donnelly
5e5ceadb99
librados: remove unused headers
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2020-08-28 19:16:18 -07:00
Sage Weil
269b949ab4 librados: fall back to legacy blacklist command if blocklist gets EINVAL
I would have expected ENOSYS or EOPNOTSUPP or similar, but the mon returns
EINVAL on an unrecognized command

Signed-off-by: Sage Weil <sage@newdream.net>
2020-08-24 19:53:08 +00:00
Sage Weil
dfd01d7653 blacklist -> blocklist
Signed-off-by: Sage Weil <sage@newdream.net>
Signed-off-by: Neha Ojha <nojha@redhat.com>
2020-08-24 19:53:08 +00:00
myoungwon oh
e9b10e1f3d osd: make set_chunk as ReadOperation
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsumg.com>
2020-08-18 21:19:20 +09:00
Samuel Just
f88211b6ac
Merge pull request #29283 from myoungwon/wip-refcount-snap
osd: refcounting chunks for snapshotted manifest object

Reviewed-by: Samuel Just <sjust@redhat.com>
Reviewed-by: Greg Farnum <gfarnum@redhat.com> (portions Sam wrote)
2020-07-14 15:52:42 -07:00
Kefu Chai
89a5e3d82d
Merge pull request #32707 from petrutlucian94/windows.4
Windows support [part 4]

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
Reviewed-by: Jason Dillaman <dillaman@redhat.com>
Reviewed-by: Kefu Chai <kchai@redhat.com>
2020-07-11 19:28:16 +08:00
Lucian Petrut
2d221a3bd1 cls,rados,rbd,mds,common: Avoid name collision with Windows headers
There are a few name collisions between Windows headers and ceph.
Where possible, we'll update Ceph code to avoid redefinitions.

The following names overlap with Windows headers:
* ERROR, NO_ERROR
* DELETE
* LocalLock
* LOCK_SHARED, LOCK_EXCLUSIVE

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2020-07-08 06:38:39 +00:00
Jason Dillaman
2148f22db6 neorados: build new RADOS client using legacy librados::Rados
Client libraries like librbd cannot force the adaptation to neorados
and it would not be ideal to have two effective RADOS cluster
connections for librados and neorados.

The new neorados::RADOS::make_with_librados helper method will
allow neorados to re-use the existing thread pool, MGR, MON, and
objecter already created for librados::Rados.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2020-07-06 17:11:07 -04:00
Radoslaw Zarzynski
3fdfd606f1 common/bl, *: deprecate list::claim() in favor of operator=(list&&).
The motivation is that `claim(list&)` seems to actually be a pre-C++11
counterpart of the already available `operator=(list&&)`.
This commit deprecates the `claim()` method but doesn't drop it yet.

All occurrences of `buffer::list::claim(list&)` are switched to
  * `list::operator=(list&&)` or
  * reworked to use `list::list(list&&)` instead.

Changes are applied to: rgw, osdc, osd, os/memstore, os/filestore,
os/bluestore, os, msg, mgr, messages, mds, librbd, librados, crimson,
common, cls, mon.

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
2020-06-29 13:29:54 +02:00
myoungwon oh
ede9164db0 osd: change tier-flush's operation type to ReadOperation
existing flush is the ReadOperation in order to flush older
clone that head.
Like existing flush, change tier-flush's type to ReadOperation

Signed-off-by: Myoungwon Oh <ohmyoungwon@gmail.com>
2020-06-14 15:45:16 +09:00
Adam C. Emerson
e3a0504037 osdc: Asiofact the Objecter
Thanks to Casey Bodley <cbodley@users.noreply.github.com> for
watch/notify fixes and Patrick Donnelly <pdonnell@redhat.com> for MDS
fix.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
2020-05-15 10:55:10 -04:00
Adam C. Emerson
306eebe05b monc: Asifoact MonClient
Of course now everyone has to feed an io_context into the MonClient.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
2020-05-15 10:55:10 -04:00
Adam C. Emerson
632e4d839f common: move to_string and to_integer overloads into root namespace
Since that's where the type is defined, that's where overloads taking
it should be defined.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
2020-04-06 04:11:12 -04:00
Kefu Chai
e1ee209087
Merge pull request #33536 from yuvalif/sync_object_write_with_return_value_op
librados: allow passing flags to operate sync APIs

Reviewed-By: Casey Bodley <cbodley@redhat.com>
Reviewed-by: Sage Weil <sage@redhat.com>
2020-03-02 19:10:29 +08:00
Kefu Chai
3ae08245a1
Merge pull request #33373 from rzarzynski/wip-bl-bumpup_api_verion
common, include: bump the version of ceph::buffer's C++ API.

Reviewed-by: Kefu Chai <kchai@redhat.com>
2020-03-02 18:25:21 +08:00
Chunmei Liu
a54d0a90c0 crimson:common add TOPNSPC namespace for ceph and crimson
some code coexist in crimson seastar environment and posix environment,
so add namespace to avoid same function conflict, for example add namespace
for CephContext, since the new namespace for classic ceph-osd,
need modify all files declare use CephContext by including "common_fwd.h"
which defined the namespace for each environment.

Signed-off-by: Chunmei Liu <chunmei.liu@intel.com>
2020-02-27 19:56:29 -08:00
Yuval Lifshitz
bf8ea9a698 librados: allow passing flags to operate sync APIs
this would allow returning values from sync write operations
by passing the RETURNVEC flag to the sync versions of the APIs

Signed-off-by: Yuval Lifshitz <yuvalif@yahoo.com>
2020-02-25 17:02:29 +02:00
Radoslaw Zarzynski
205e993b98 common, include: bump the version of ceph::buffer's C++ API.
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
2020-02-17 16:47:23 +01:00
Sage Weil
64ef3242bf Merge PR #32831 into master
* refs/pull/32831/head:
	common, include: drop the copy{_in} from bufferlist entirely.
	os/bluestore: switch copy_in() users to bufferlist::iterator.
	osdc: switch users of bufferlist::copy{_in} to iterators.
	osd: switch users of bufferlist::copy{_in} to iterators.
	rgw: switch copy{_in} users to bufferlist::iterator.
	ec: switch users of bufferlist::copy{_in} to iterators.
	cls/queue: switch users of bufferlist::copy{_in} to iterators.
	client: switch users of bufferlist::copy{_in} to iterators.
	*: switch trivial users of bufferlist::copy{_in} to iterators.
	test/bl: switch copy{_in} users to bufferlist::iterator.
	common, include: kill the bl::last_p member.
	common: encode for std::list<T> doesn't use bl::copy_in() anymore.

Reviewed-by: Kefu Chai <kchai@redhat.com>
2020-02-03 21:28:19 -06:00
Kefu Chai
5fcf0641cd librados: prefer reinterpret_cast over c-style cast
Signed-off-by: Kefu Chai <kchai@redhat.com>
2020-02-03 18:16:09 +08:00
Radoslaw Zarzynski
d5e6db8c40 *: switch trivial users of bufferlist::copy{_in} to iterators.
This commits switches the most straightforward occurrences of:
  * ceph::bufferlist::copy(off, len, dst) and
  * ceph::bufferlist::copy_in(off, len, src)
to use iterators. After extending `bufferlist::begin()` with
the `offset` parameter and eradication of the `last_p` hint,
these method look rudimentary. There is no huge benefit from

  bl.copy_in(off, len, dst)

instead of:

  bl.begin(off).copy_in(len, dst)

especially when `off` is `0`.

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
2020-01-26 16:22:24 +01:00
Kefu Chai
dba2b80897
Merge pull request #31728 from luis-henrix/copy-from-notrunc
osd: add a 'copy-from2' operation that includes truncate_{seq,size} parameters

Reviewed-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Ilya Dryomov <idryomov@redhat.com>
Reviewed-by: Greg Farnum <gfarnum@redhat.com>
2020-01-06 10:07:45 +08:00
Adam Kupczyk
282ac64b6d librados: fix leak in getxattr and getxattrs
Issue was related to missing put() on AioCompletionImpl.
Signed-off-by: Adam Kupczyk <akupczyk@redhat.com>
2019-12-16 10:49:42 -05:00
Luis Henriques
92c6610b26 librados, osd: add copy_from2 to librados and Objecter
This commit simply adds this new version of the copy_from operation to
librados and to Objecter.

Signed-off-by: Luis Henriques <lhenriques@suse.com>
2019-12-04 11:09:51 +00:00
Patrick Donnelly
df507cde8d
mgr: forward RADOS client instances for potential blacklist
The mgr creates a per-module RADOS client connection for modules which
interact with RADOS (e.g. the volumes module). These clients should also
be blacklisted when the active mgr is failed; we don't want the former
active mgr to continue interacting with RADOS when the new one takes
over. This is particularly impactful for avoiding extraneous
"unresponsive client" warnings from the MDS when the mgr switches
(especially in testing). The MDS will pickup the new OSD blacklists
which include's the old mgr's libcephfs instance and blacklist/evict
that session quietly.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
2019-12-03 17:53:14 -08:00
Kefu Chai
3e66ada648
Merge pull request #31692 from rzarzynski/wip-fips-zeroize-memset_bzero
FIPS: audit and switch some memset & bzero users

Reviewed-by: Marcus Watts <mwatts@redhat.com>
2019-11-25 01:05:16 +08:00
Kefu Chai
0847955aa9
Merge pull request #30204 from tchaikov/wip-test-aio-completion-release
test/librados: free AioCompletion using AioCompletion::release()

Reviewed-by: Sage Weil <sage@redhat.com>
2019-11-25 00:59:25 +08:00
Kefu Chai
91c7ecb490 librados: release pimpl pointer in destructor
before this change, the librados applications are responsible to call
`AioCompletion::release()` explicitly to release its internal pimpl
pointer. this is error prone and not intuitive.

after this change, the destructor of `AioCompletion` and
`PoolAsyncCompletion` will do this automatically. while
`AioCompletion::release()` and `PoolAsyncCompletion::release()` still
delete the instance as they did before. so this change is backward
compatible, as existing librados clients can still use `ptr->release()`
to free the completion instance, while new clients can just `delete
ptr`.

librados_test_stub is updated accordingly to match the new model

Signed-off-by: Kefu Chai <kchai@redhat.com>
2019-11-23 00:43:45 +08:00