The only externally visible change is that Objecter::get_osdmap_read
and Objedcter::put_osdmap_read have been removed in favor of
Objecter::with_osdmap.
It can be used like:
objecter->with_osdmap([&](const OSDMap& o) { o.do_stuff(); };
int x = objecter->with_osdmap([&](const OSDMap& o) {
return get_thing(id); });
objecter->with_osdmap(std::mem_fn(&OSDMap::do_stuff));
int x = objecter->with_osdmap(std::mem_fn(&OSDMap::get_thing),
id);
The choice between the style of the first two examples or the second two
is arbitrary and depends on what you prefer.
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
This concisely fixes several unittest builds, and reflects the
fact that this library dependency has moved into several areas
of the codebase (libcephfs, librbd, librgw).
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
The opaque structure will support journal client applications to
store and retrieve complex state.
Fixes: #13298
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
In the case of librbd, a new tag will be allocated when the
exclusive lock is acquired. All tags for the same dataset
(e.g. librbd image) will belong to the same class. Tags are
automatically pruned on tag create / client unregister
if no other clients' commit position would require the tags.
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
For the real-time clocks, Ceph's testing infrastructure likes to be able to
inject a skew. To avoid pulling CephContext into ceph_time.h these are moved to
ceph_time.cc. The original way this was done called clock_gettime in both
places.
This is an unnecessary duplication and apparently error-prone. So only call
clock_gettime from one place.
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
Just make a separate flag to indicate whether we create a block
file. This lets us drop the weird touch in vstart.sh, and default
to creating a token 'block' file on --mkfs.
Signed-off-by: Sage Weil <sage@redhat.com>
The get_omap_iterator shall check the existence of onode too,
which may race with the rename method.
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
The get_omap_iterator shall check the existence of onode too, which may
race with the rename method.
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
Enode only uses intrusive unordered_set base hook, member hook is not neccesary.
This should save some memory space, when we have tons of enodes.
Signed-off-by: Jianjian Huo <samuel.huo@gmail.com>
Fixes the following bugs:
* the fd is open(O_WRONLY) and cannot be read from, safe_read
always fails and never removes the pid file.
* pidfile_open(g_conf) is close(STDOUT_FILENO) and there is a risk that
pidfile_open gets STDOUT_FILENO only to have it closed and redirected
to /dev/null.
* Before writing the file, ftruncate it so that overriding a file
containing the pid 1234 with the pid 89 does not end up being
a file with 8934.
* Before reading the file, lseek back to offset 0 otherwise it
will read nothing.
* tests_pidfile was missing an argument when failing
TEST_without_pidfile and killed all process with ceph in their name,
leading to chaos and no useful error message.
* lstat(fd) cannot possibly return a result different from the one
obtained right after the file was open, stat(path) must be used
instead.
In addition to fixing the bugs above, refactor the pidfile.cc
implementation to:
* be systematic about error reporting (using cerr for when removing
the pidfile because derr is not available at this point and derr
when creating the pidfile).
* replace pidfile_open / pidfile_write with just pidfile_write since
there never is a case when they are not used together.
More test cases are added to test_pidfile to verify the bugs above are
fixed.
http://tracker.ceph.com/issues/13422Fixes: #13422
Signed-off-by: Loic Dachary <loic@dachary.org>
We were failing to set o->enode, which meant that there were
multiple instances of the same enode alive at once. Avoid this
category of bug by changing _txc_release to take the onode ref
and assign it there, and removing almost all of the local EnodeRef
instances.
Signed-off-by: Sage Weil <sage@redhat.com>