Danny Al-Gaaf [Thu, 14 Feb 2013 13:36:37 +0000 (14:36 +0100)]
init-ceph.in: replace "/var/run/" by already used $RUN_DIR
Fix handling of admin socket. The current script already use
$RUN_DIR to define a default, which is /var/run. Replace the
explicit path from get_conf call and replace it with $RUN_DIR.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Travis Rhoden [Thu, 14 Feb 2013 16:23:52 +0000 (11:23 -0500)]
doc: Update create example to use 'allow ' syntax
The ceph auth get-or-create example here is the only place on the
page that does not use 'allow <perms.' syntax. I found that
confusing. Update to use allow and single quotes.
Danny Al-Gaaf [Thu, 14 Feb 2013 14:11:18 +0000 (15:11 +0100)]
ceph.spec.in: cleanup requirements of fuse packages
Cleanup the Requires: list of the fuse packages. Remove fuse-libs,
libstdc++, libuuid. Don't add libraries to the list, the RPM build
system will find the dependencies by itself.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
James Page [Thu, 14 Feb 2013 13:10:39 +0000 (13:10 +0000)]
LDADD PTHREAD_LIBS to fix librados-config linking
librados-config depends on libglobal which in turn
reference symbols in pthread; this caused issues
when linking due to the indirect dependency via
libglobal.
Loic Dachary [Thu, 14 Feb 2013 11:05:54 +0000 (12:05 +0100)]
fix buffer::list::zero(unsigned o, unsigned l) to act on all buffer::ptr
When buffer::list::zero was called on a buffer::list with "ABC" and
"DEF" in two different buffer::ptr with buffer::list::zero(4, 1) it
did nothing. The expected result is that the "DEF" buffer::ptr is
modified to "D\0F"
The test to check if the pointer is past the end of range to be zeroed
was reversed. It was o+l >= p which would always be true if the range
spans over the first buffer::ptr . It must be "o+l <= p" meaning the
pointer is past the end of the range and there is no need to loop over
the remaining buffer::ptr in the buffer::list
The p+it->length() >= o+l part of the if (p >= o && p+it->length() >=
o+l) test was also reversed. When called on "ABC" with zero(0, 1) it
would match because the range to be zeroed is contained in the
buffer::ptr. The call to it->zero() would zero the entire buffer::ptr
instead of just the first character.
unit tests are added to demonstrate the two problems with the previous
code and show that the patch fixes them.
Sam Lang [Wed, 13 Feb 2013 18:37:32 +0000 (12:37 -0600)]
libcephfs: Fix shutdown segfault
client->shutdown() should only be called once, but with
new inited flag, we were calling it twice. This sets
the inited flag back to false after client->shutdown()
is called the first time.
Sage Weil [Sun, 27 Jan 2013 03:08:22 +0000 (19:08 -0800)]
ceph-disk-prepare: refactor to support DIR, DISK, or PARTITION for data or journal
Lots of code reorganization collapsed into a single commit here.
- detect whether the user gave us a directory, disk, or partition, and Do The
Right Thing
- allow them to force that the input was of type X, for the careful/paranoid.
- make --zap-disk an option -- no longer the default
David Zafman [Mon, 11 Feb 2013 20:20:23 +0000 (12:20 -0800)]
osd/PG: store pg_info_t in leveldb (omap), purged_snaps separately
Separate the purged_snaps portion of pg_info_t (the one that gets big).
Feature #3891: osd: move purged_snaps out of info
Add a separate dirty_big_info flag so that we only update the pginfo
"biginfo" file if that state changes. This lets us avoid the cost in the
general case, like a regular PG write.
Add LEVELDBINFO feature
Put info, biginfo in leveldb
Move epoch to omap
Feature #3892: osd: move pg info into leveldb
Signed-off-by: Sage Weil <sage@inktank.com> Signed-off-by: David Zafman <david.zafman@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com> Reviewed-by: Sam Just <sam.just@inktank.com>
Sam Lang [Tue, 12 Feb 2013 17:32:29 +0000 (11:32 -0600)]
deb: Add ceph-coverage to ceph-test deb package
Teuthology uses the ceph-coverage script extensively
and expects it to be installed by the ceph task. Add
the script to the ceph-test debian package so that it
gets installed for that use case.
Sam Lang [Tue, 12 Feb 2013 22:33:58 +0000 (16:33 -0600)]
mds: Setting pool on a file requires latest osdmap
If we create a file, then create a pool, then try to
set the pool on the file with the vxattr, no mds operation
triggers a request for the latest osdmap, so we get back
EINVAL. So if we fail to find the pool initially, fall back
to requesting a new osdmap and trying the vxattr again. We
don't wait for a new map if we don't get anything newer than
what we already have.
Signed-off-by: Sam Lang <sam.lang@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
Sage Weil [Tue, 12 Feb 2013 22:11:09 +0000 (14:11 -0800)]
osd: only share maps on hb connection of OSD_HBMSGS feature is set
Back in 1bc419a7affb056540ba8f9b332b6ff9380b37af we started sharing maps
with dead osds via the heartbeat connection, but old code will crash on an
unexpected message. Only do this if the OSD_HBMSGS feature is present.
Signed-off-by: Sage Weil <sage@inktank.com> Reviewed-by: Samuel Just <sam.just@inktank.com>
Danny Al-Gaaf [Tue, 12 Feb 2013 21:17:38 +0000 (22:17 +0100)]
mds/LogEvent.h: change print() signature to const
Fix print() function of src/mds/LogEvent.h, declare as
virtual void print(ostream& out) const {...}
Adapt functions of derived classes. This should fix a problem
with print function of derived classes EImportStart and
EImportFinish, which had a const signature, hiding virtual
function of the base class LogEvent (which wasn't const).
Fix -Woverloaded-virtual warning from clang was:
mds/events/EImportStart.h:43:8: warning: 'EImportStart::print'
hides overloaded virtual function [-Woverloaded-virtual]
void print(ostream& out) const {
^
mds/events/../LogEvent.h:95:16: note: hidden overloaded virtual
function 'LogEvent::print' declared here
virtual void print(ostream& out) {
^
In file included from mds/journal.cc:31:
mds/events/EImportFinish.h:35:8: warning: 'EImportFinish::print'
hides overloaded virtual function [-Woverloaded-virtual]
void print(ostream& out) const {
^
mds/events/../LogEvent.h:95:16: note: hidden overloaded
virtual function 'LogEvent::print' declared here
virtual void print(ostream& out) {
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Sage Weil [Sun, 10 Feb 2013 05:36:58 +0000 (21:36 -0800)]
osd: make coll_t::is_pg() correctly validate the snapid suffix
The strtoull() man page suggests resetting errno and using that to
check for a parsing error. This ensures the OSD::load_pgs() callers are
getting what they expect (now that they aren't relying on the broken
behavior). The other callers in the os/* code is moved to a different
method that ignores the suffix.
Sage Weil [Sun, 10 Feb 2013 05:34:02 +0000 (21:34 -0800)]
os: use coll_t:is_pg_prefix() check instead of is_pg()
The objectstore code was trying to parse out a pgid from the collection
name and using the is_pg() helper, which incorrectly tolerates a _TEMP
suffix and returns a bad value for the snapid. The objectstore doesn't
actually care about that value, so this is harmless, but sloppy.
Introduce a simpler is_pg_prefix() helper and use that instead.
Loic Dachary [Thu, 7 Feb 2013 23:59:43 +0000 (00:59 +0100)]
Unit tests for chain_xattr.cc
Create a new test file covering most (> 97%) of src/os/chain_xattr.{cc,h}
lines of code. The following functions are tested:
int chain_getxattr(const char *fn, const char *name, void *val, size_t size);
int chain_fgetxattr(int fd, const char *name, void *val, size_t size);
int chain_setxattr(const char *fn, const char *name, const void *val, size_t size);
int chain_fsetxattr(int fd, const char *name, const void *val, size_t size);
int chain_listxattr(const char *fn, char *names, size_t len);
int chain_flistxattr(int fd, char *names, size_t len);
int chain_removexattr(const char *fn, const char *name);
int chain_fremovexattr(int fd, const char *name);
The function translate_raw_name substitutes @@ into @. When the trailing
character is a @, it breaks. However, such an occurence cannot be created by
chain_setxattr because it always create pairs of @. Instead of silently
breaking the loop, the function should probably return on error so that the
caller can ignore it.
The function chain_fgetxattr_len may return on error if fgetxattr
returns on error. However, it is only called after another attr function
returned success and the tests cannot create the conditions under which
it would fail.
The function chain_fsetxattr may leak attributes when used to override
an existing attribute. This leak is not tested or fixed, it is just
discussed in http://marc.info/?l=ceph-devel&m=136027076615853&w=4
If the file system in which the tests are run does not support extended
attributes, the tests are not run. The detection uses the same logic as
the one implemented in FileStore::_detect_fs
The output of the tests are silenced to reduce the output when testing
assertions ( except for the dout_emergency function which cannot be
controlled).
Sage Weil [Mon, 11 Feb 2013 14:23:54 +0000 (06:23 -0800)]
osd: update snap collections for sub_op_modify log records conditionaly
The only remaining caller is sub_op_modify(). If we do have a non-empty
op transaction, we want to do this update, regardless of what we think
last_backfill is (our notion may be not completely in sync with the
primary). In particular, our last_backfill may be the same object but
a different snapid, but the primary disagrees and is pushing an op
transaction through.
Instead, update the collections if we have a non-empty transaction.
Signed-off-by: Sage Weil <sage@inktank.com> Reviewed-by: Samuel Just <sam.just@inktank.com>
Sage Weil [Mon, 11 Feb 2013 00:59:48 +0000 (16:59 -0800)]
osd: unconditionally encode snaps buffer
Previously we would only encode the updated snaps vector for CLONE ops.
This doesn't work for MODIFY ops generated by the snap trimmer, which
may also adjust the clone collections. It is also possible that other
operations may need to populate this field in the future (e.g.,
LOST_REVERT may, although it currently does not).
Fixes: #4071, and possibly #4051. Signed-off-by: Sage Weil <sage@inktank.com> Reviewed-by: Samuel Just <sam.just@inktank.com>
Joe Buck [Sun, 10 Feb 2013 02:48:57 +0000 (18:48 -0800)]
libcephfs: fix for #4068
If client->init() fails in mount, then client->shutdown()
should not be called. This patch uses a bool to ensure
that shutdown is only called if init() succeeds.
Signed-off-by: Joe Buck <jbbuck@gmail.com> Reviewed-by: Sam Lang <sam.lang@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
ceph_authtool.cc:15:17: warning: using directive refers to
implicitly-defined namespace 'std'
using namespace std;
^ Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
librados/librados.cc:15:17: warning: using directive refers to
implicitly-defined namespace 'std'
using namespace std;
^
Include what we need and use the related classes.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Thu, 7 Feb 2013 19:16:46 +0000 (20:16 +0100)]
src/osd/PG.h: use empty() instead of size()
Fix warning for usage of objects.size(). Use empty() since it
should be prefered as it has, following the standard, a constant
time complexity regardless of the containter type. The same is not
guaranteed for size().
warning from cppchecker was:
[osd/PG.h:599]: (performance) Possible inefficient checking for
'objects' emptiness.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Thu, 7 Feb 2013 19:14:34 +0000 (20:14 +0100)]
src/osd/OSD.h: use empty() instead of size()
Fix warning for usage of *.size(). Use empty() since it should be
prefered as it has, following the standard, a constant time
complexity regardless of the containter type. The same is not
guaranteed for size().
warning from cppchecker was:
[osd/OSD.h:265]: (performance) Possible inefficient checking for
'last_scrub_pg' emptiness.
[osd/OSD.h:274]: (performance) Possible inefficient checking for
'last_scrub_pg' emptiness.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>