Commit Graph

27952 Commits

Author SHA1 Message Date
Sage Weil
b26b7f6e5e mon/Paxos: only share uncommitted value if it is next
We may have an uncommitted value from our perspective (it is our lc + 1)
when the collector has a much larger lc (because we have been out for
the last few rounds).  Only share an uncommitted value if it is in fact
the next value.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-22 14:13:23 -07:00
Sage Weil
99e605455f mon/Paxos: accepted_pn_from has no semantic meaning
Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-22 14:12:51 -07:00
Sage Weil
a61635e852 ceph-monstore-tool: dump paxos transactions
Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-22 14:12:51 -07:00
Dan Mick
e60d14d97d ceph.in: reject --admin-daemon so it can't do harm
Fixes: #3944
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-07-22 13:12:33 -07:00
Gary Lowell
835dd97301 v0.67-rc1 2013-07-22 11:57:27 -07:00
Noah Watkins
58c78dbaf3 FileJournal: fix posix_fallocate error handling
From the man page for posix_fallocate:

    posix_fallocate() returns zero on success, or an error
    number on failure.  Note that errno is not set.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Reviewed-by: Sage Weil <sage@inktank.com>
2013-07-22 11:43:01 -07:00
Samuel Just
0897d3a820 OSD::_make_pg: use createmap, not osdmap
The osd lock is not held at this point, we must use
the createmap passed in.

Fixes: #5656
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
2013-07-22 11:11:08 -07:00
Yehuda Sadeh
20bc09c668 rgw: read attributes when reading bucket entry point
Fixes: #5691

We need to also read the attributes, as bucket might be a legacy
bucket and might have all bucket instance info in that object.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
Tested-by: Faidon Liambotis <faidon@wikimedia.org>
2013-07-22 10:11:13 -07:00
Samuel Just
d28c18da9d OSD::RemoveWQ: do not apply_transaction while blocking _try_resurrect_pg
Some callbacks take the osd lock, so we need to avoid blocking an
osd lock holding thread while waiting on a filestore callback.
Instead, just queue the transaction, and allow _try_resurrect_pg
to cancel us while we are waiting for the transaction to go through
(CLEARING_WAITING).

Fixes: #5672
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
2013-07-22 10:31:31 -07:00
Samuel Just
6c4cd22e60 FileStore: use complete() instead of finish() and delete
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
2013-07-22 10:31:19 -07:00
Samuel Just
9f591a630d Finisher: use complete() not finish() and delete
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
2013-07-22 10:31:12 -07:00
Samuel Just
8536ff9a43 common/Cond.h: add a simpler C_SaferCond Context
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
2013-07-22 10:31:02 -07:00
Gary Lowell
eabf2f6ae1 ceph.spec.in: Obsolete ceph-libs
Signed-off-by: Gary Lowell  <gary.lowell@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
2013-07-22 09:52:19 -07:00
Sage Weil
e58b0e9320 Merge remote-tracking branch 'gh/wip-mon-caps' into next
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
2013-07-22 09:27:35 -07:00
Danny Al-Gaaf
db2850c532 test_cls_statelog.cc: fix resource leak, delete 'rop' at end of function
CID 1049213 (#3 of 3): Resource leak (RESOURCE_LEAK)
  leaked_storage: Variable "rop" going out of scope leaks the
  storage it points to.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-07-22 17:19:29 +02:00
Danny Al-Gaaf
5f4f87b00e test_cls_statelog.cc: fix resource leak, delete op at end of function
CID 1049214 (#13 of 13): Resource leak (RESOURCE_LEAK)
  leaked_storage: Variable "op" going out of scope leaks the
  storage it points to.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-07-22 14:35:03 +02:00
Danny Al-Gaaf
fc1c1c6fdc test_cls_statelog.cc: fix resource leak, delete rop at end of function
CID 1049215 (#12 of 12): Resource leak (RESOURCE_LEAK)
  leaked_storage: Variable "rop" going out of scope leaks the
  storage it points to.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-07-22 12:58:28 +02:00
Danny Al-Gaaf
8e8596d201 test_cls_version.cc: fix resource leak, delete before new()
Fix some more cases where resource wasn't deleted/freed before
call new().

CID 1049216 (#1-9 of 9): Resource leak (RESOURCE_LEAK)
  overwrite_var: Overwriting "op" in "op = new_op()" leaks
  the storage that "op" points to.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-07-22 12:58:28 +02:00
Danny Al-Gaaf
3e94393000 test_cls_version.cc: fix resource leak, delete before new()
CID 1049217 (#1 of 1): Resource leak (RESOURCE_LEAK)
  overwrite_var: Overwriting "op" in "op = new_op()" leaks
  the storage that "op" points to.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-07-22 12:58:28 +02:00
Danny Al-Gaaf
d3782d80d5 test_cls_version.cc: fix another ressource leak
CID 1049219 (#17 of 17): Resource leak (RESOURCE_LEAK)
  leaked_storage: Variable "op" going out of scope leaks the
  storage it points to.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-07-22 12:58:28 +02:00
Danny Al-Gaaf
c35eeae3c2 test_cls_version.cc: fix ressource leak
CID 1049220 (#18 of 18): Resource leak (RESOURCE_LEAK)
  leaked_storage: Variable "rop" going out of scope leaks
  the storage it points to.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-07-22 12:58:28 +02:00
Danny Al-Gaaf
637e106e70 cls/rgw/cls_rgw.cc: init start_key_added with false
Fix for coverity issue:

CID 1049231 (#1 of 1): Uninitialized scalar variable (UNINIT)
  uninit_use: Using uninitialized value "start_key_added".

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-07-22 12:58:28 +02:00
Sage Weil
da2cb0901d Merge pull request #453 from dalgaaf/wip-da-SCA-cppcheck-7
Fix SCA and CID issues

Reviewed-by: Sage Weil <sage@inktank.com>
2013-07-21 21:42:07 -07:00
Sage Weil
c456390158 Merge pull request #451 from dalgaaf/wip-da-SCA-cppcheck-6-v2
Fix some issues from SCA - v2 - against ceph:next

Reviewed-by: Yehuda Sadeh <yehuda@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
2013-07-21 21:40:22 -07:00
Danny Al-Gaaf
617b3f750e cls_replica_log_types.h: pass const std::list<> by reference
Pass  const std::list<> parameter by refrence to
cls_replica_log_progress_marker().

From cppcheck:
 [src/cls/replica_log/cls_replica_log_types.h:64]: (performance)
  Function parameter 'b' should be passed by reference.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-07-20 20:15:57 +02:00
Danny Al-Gaaf
6319823443 mon/PGMonitor.cc: reduce scope of local 'num_slow_osds' variable
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-07-20 20:02:36 +02:00
Danny Al-Gaaf
cf29d17666 rgw/rgw_bucket.cc: use static_cast<>() instead of C-Style cast
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-07-20 19:52:18 +02:00
Danny Al-Gaaf
d181aaaed4 test_cls_version.cc: don't free object twice, free the right one
Object 'librados::ObjectWriteOperation *op' is freed twice in the TEST
test_version_inc_read. Free instead 'librados::ObjectReadOperation *rop'

Related cppcheck warning:
 [src/test/cls_version/test_cls_version.cc:79]: (error) Memory
  pointed to by 'op' is freed twice.

This should also fix:

CID 1049247 (#1 of 1): Use after free (USE_AFTER_FREE)
  deref_arg: Calling "librados::ObjectWriteOperation::~ObjectWriteOperation()"
  dereferences freed pointer "op". (The dereference happens because this is
  a virtual function call.)
CID 1049218 (#4 of 4): Resource leak (RESOURCE_LEAK)
  leaked_storage: Variable "rop" going out of scope leaks the storage it
  points to.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-07-20 19:43:29 +02:00
Danny Al-Gaaf
11c51e8485 rgw/rgw_metadata.cc: use static_cast<>() instead of C-Style cast
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-07-20 19:30:04 +02:00
Danny Al-Gaaf
e910421719 rgw: change RGWOp::name() to return string instead of char*
Return 'const string' instead of 'const char *' from RGWOp::name() to
avoid the usage of std::string:c_str() to return 'const char *' in
some cases in rgw_rest_replica_log.h.

Returning result of c_str() from a function is dangerous since the
result gets (may) invalid after the related string object gets
destroyed or out of scope (which is the case with return). So you
may end up with garbage in this case.

Related warning from cppcheck:
 [src/rgw/rgw_rest_replica_log.h:39]: (error) Dangerous usage of
  c_str(). The value returned by c_str() is invalid after this call.
 [src/rgw/rgw_rest_replica_log.h:59]: (error) Dangerous usage of
  c_str(). The value returned by c_str() is invalid after this call.
 [src/rgw/rgw_rest_replica_log.h:79]: (error) Dangerous usage of
  c_str(). The value returned by c_str() is invalid after this call

This should also fix:

CID 1049250 (#1 of 1): Wrapper object use after free (WRAPPER_ESCAPE)
  escape: The internal representation of "s" escapes, but is destroyed
  when it exits scope.
CID 1049251 (#1 of 1): Wrapper object use after free (WRAPPER_ESCAPE)
  escape: The internal representation of "s" escapes, but is destroyed
  when it exits scope.
CID 1049252 (#1 of 1): Wrapper object use after free (WRAPPER_ESCAPE)
  escape: The internal representation of "s" escapes, but is destroyed
  when it exits scope.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-07-20 19:02:18 +02:00
Sage Weil
c3acc25608 mon, mds, osd: add early SIGTERM injection
This makes it easy to identify problems with (early) shutdown with a
loop like

 while [ ! -e core ] ; do ./ceph-mds -i a -c ceph.conf -f ; done

and a vstart cluster.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-20 08:49:48 -07:00
Sage Weil
7e25fecdfe mds: put g_ceph_context on shutdown
This makes us shut down lots of threads.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-20 08:47:51 -07:00
Sage Weil
1fd01e3b5b mon: shutdown: remove sessions under mon->lock
Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-20 08:47:20 -07:00
Sage Weil
ba5e357e4e mds: reorder suicide/shutdown a bit
* shutdown msgr last
* stop timer quickly, in case there are other events

Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-20 08:46:57 -07:00
Sage Weil
318f3df718 mds: install signal handlers after init
Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-20 08:37:44 -07:00
Sage Weil
868b48634b mon: install signal handlers after init
Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-20 08:37:26 -07:00
Sage Weil
b084a3877f osd: do not assume we have an osdmap in prepare_to_stop
Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-20 08:11:43 -07:00
Sage Weil
61a298c39c osd: install async signal handlers after init()
The orderly shutdown in OSD assumes init() has completed.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-20 08:10:42 -07:00
Sage Weil
3dec530de6 qa/workunits/mon/caps.sh: clean up users; rename
Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 22:32:23 -07:00
Sage Weil
675d783aed mon/MonCap: simplify rwx match logic
Make this a positive check instead of double negative.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 22:32:23 -07:00
Sage Weil
f79d965049 mon: fix command caps check
We must require something or else the caps check is going to pass in
a degenerate sense.  Use X for commands.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 22:32:23 -07:00
Joao Eduardo Luis
fb2150425b qa: workunits: mon: test mon caps permissions
set env var TEST_EXIT_ON_ERROR=0 to obtain all errors instead of exiting
with return 1 on first error found.

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
2013-07-19 21:18:07 -07:00
Sage Weil
73b4003f65 Merge remote-tracking branch 'gh/wip-swift' into next
Reviewed-by: Greg Farnum <greg@inktank.com>
2013-07-19 21:08:18 -07:00
Sage Weil
0356eebfa5 mon/PaxosService: update on_active() docs to clarify calling rules
Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 16:59:15 -07:00
Sage Weil
6d326b8424 mon/OSDMonitor: discard failure waiters, info on shutdown
This would prevent a leak, if we didn't assert before that in the
failure_reporter_t dtor.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 16:57:04 -07:00
Sage Weil
8371680bab mon: OSDMonitor: only thrash and propose if we are the leader
'thrash_map' is only set if we are the leader, so we would thrash and
propose the pending value if we are the leader.  However, we should keep
the 'is_leader()' check not only for clarity's sake (an unfamiliar reader
may cry OMGBUG, prompting to a patch much like this), but also because
we may lose a subsequent election and become a peon instead, while still
holding a 'thrash_map' value > 0 -- and we really don't want to propose
while being a peon.

[This is a rebased version of 5eac38797d,
complete with the typo fix in d656aed599ee754646e16386ce5a4ab0117f2d6e.]

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
2013-07-19 16:39:49 -07:00
Sage Weil
e4f2e3ecd0 mon/OSDMonitor: do not wait for readable in send_latest()
send_latest() checks for readable and, if untrue, will wait before sending
out the latest OSDMap.  This is completely unnecessary; I think it is a
hold-over from when we have independent paxos states.  An audit of all
callers confirms that everyone would be happy with whatever is committed,
even if we are in the process of committing an even newer version.

Effectively, everyone waits *above* this layer in the usual PaxosService
traps for whether we are readable or not.  This means that waiting_for_map
and send_to_waiting() go away entirely, which is nice.

This addresses, among other things: send_to_waiting() is called from
update_from_paxos(), which can be called when we are not readable due to
the paxos commit/finish timing changes in f1ce8d7c95 and
c711203c0d.  If no subsequent update happens, those waiters never get
their maps.

Instead, we send them immediately--we know they are committed and old
history is as good as future history.

Fixes: #5643
Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 16:39:49 -07:00
Sage Weil
6edec516bf Revert "mon/OSDMonitor: send_to_waiting() in on_active()"
This reverts commit f06a124a7f.

On peons, on_active() is only called when we *first* become active after an
election.  Only on the leader is it called after each commit/update.  This
makes this change cause other problems (broken subscriptions on peons, in
particular).  We possibly should fix that, but there is also a simpler fix
for the original problem we were trying to solve.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-07-19 16:39:47 -07:00
Sage Weil
2795eb1232 Revert "mon: OSDMonitor: only thrash and propose if we are the leader"
This reverts commit 5eac38797d.
2013-07-19 16:23:04 -07:00
Sage Weil
0a9964934d Revert "mon/OSDMonitor: fix typo"
This reverts commit d656aed599.
2013-07-19 16:22:48 -07:00