Commit Graph

26509 Commits

Author SHA1 Message Date
Joao Eduardo Luis
de499676a6 mon: PaxosService: drop atomic_t on 'proposing'
We don't need this to be atomic -- a simple boolean is enough.

Fixes: #4507

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
2013-05-22 18:05:41 +01:00
Joao Eduardo Luis
c307d427d1 ceph-osd: specify which types of addresses to pick
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
2013-05-22 17:57:38 +01:00
Joao Eduardo Luis
6d8932304c ceph-mon: only care about public addr during pick_addresses()
Fixes: #4228

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
2013-05-22 17:57:38 +01:00
Joao Eduardo Luis
1ba9f84db6 common: add mask argument to pick_addresses() to specify what we need
Fixes: #4228

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
2013-05-22 17:57:37 +01:00
Sage Weil
78a1834d81 ceph: remove cli test
This is about to be removed by wip-ceph-cli anyway.  And it broke in
commit 132d5bf7f9.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-05-22 09:39:11 -07:00
Joao Eduardo Luis
e15d290945 mon: Paxos: get rid of the 'prepare_bootstrap()' mechanism
We don't need it after all.  If we are in the middle of some proposal,
then we guarantee that said proposal is likely to be retried.  If we
haven't yet proposed, then it's forever more likely that a client will
eventually retry the message that triggered this proposal.

Basically, this mechanism attempted at fixing a non-problem, and was in
fact triggering some unforeseen issues that would have required increasing
the code complexity for no good reason.

Fixes: #5102

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
2013-05-22 17:12:38 +01:00
Joao Eduardo Luis
586e8c2075 mon: Paxos: finish queued proposals instead of clearing the list
By finishing these Contexts, we make sure the Contexts they enclose (to be
called once the proposal goes through) will behave as their were initially
planned:  for instance, a C_Command() may retry the command if a -EAGAIN
is passed to 'finish_contexts', while a C_Trimmed() will simply set
'going_to_trim' to false.

This aims at fixing at least a bug in which Paxos will stop trimming if an
election is triggered while a trim is queued but not yet finished.  Such
happens because it is the C_Trimmed() context that is responsible for
resetting 'going_to_trim' back to false.  By clearing all the contexts on
the proposal list instead of finishing them, we stay forever unable to
trim Paxos again as 'going_to_trim' will stay True till the end of time as
we know it.

Fixes: #4895

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
2013-05-22 17:10:42 +01:00
Sage Weil
308d7c4609 Merge pull request #297 from dalgaaf/wip-da-CID-727982
Reviewed-by: Sage Weil <sage@inktank.com>
2013-05-22 08:54:56 -07:00
Sage Weil
0e733ba58b Merge pull request #310 from dalgaaf/wip-da-CID-fixes-4
Reviewed-by: Sage Weil <sage@inktank.com>
2013-05-22 08:37:09 -07:00
Danny Al-Gaaf
549e547b3b mds/Migrator.cc: fix possible dereference NULL return value
CID 716997 (#1 of 1): Dereference null return value (NULL_RETURNS)
  dereference: Dereferencing a pointer that might be null "in" when
  calling "MDSCacheObject::is_auth() const".

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-05-22 17:28:06 +02:00
Danny Al-Gaaf
32b024c6c6 mds/Migrator.cc: fix possible dereference NULL return value
ID 716998 (#1 of 2): Dereference null return value (NULL_RETURNS)
  dereference: Dereferencing a pointer that might be null "in" when
  calling "operator <<(std::ostream &, CInode &)".

CID 716998 (#2 of 2): Dereference null return value (NULL_RETURNS)
  dereference: Dereferencing a pointer that might be null "in" when
  calling "MDCache::add_replica_dir(ceph::buffer::list::iterator &,
  CInode *, int, std::list<Context *, std::allocator<Context *> > &)".

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-05-22 17:25:16 +02:00
Danny Al-Gaaf
ed53bf17c5 mds/Migrator.cc: delete some empty lines at EOF
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-05-22 17:23:40 +02:00
Danny Al-Gaaf
158e740935 mds/Migrator.cc: fix possible dereference NULL return value
CID 716999 (#1 of 1): Dereference null return value (NULL_RETURNS)
  dereference: Dereferencing a pointer that might be null "in" when
  calling "CInode::put_stickydirs()".

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-05-22 17:21:59 +02:00
Sage Weil
cfebb83522 Merge pull request #309 from dalgaaf/wip-da-CID-fixes-3-v2
Reviewed-by: Sage Weil <sage@inktank.com>
2013-05-22 08:20:49 -07:00
Danny Al-Gaaf
7ba34c1384 mds/Migrator.cc: fix dereference NULL return value
CID 717000 (#1 of 2): Dereference null return value (NULL_RETURNS)
  dereference: Dereferencing a pointer that might be null "dir" when
  calling "operator <<(std::ostream &, CDir &)".

CID 717000 (#2 of 2): Dereference null return value (NULL_RETURNS)
  dereference: Dereferencing a pointer that might be null "dir" when
  calling "Migrator::import_reverse_unfreeze(CDir *)".

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-05-22 17:17:01 +02:00
Danny Al-Gaaf
de1e355360 mds/Migrator.cc: fix possible NULL pointer dereference
Move dout() calls behind the related asserts to prevent possible NULL
pointer dereference.

CID 717001 (#1 of 1): Dereference null return value (NULL_RETURNS)
  dereference: Dereferencing a pointer that might be null "diri" when calling
  "operator <<(std::ostream &, CInode

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-05-22 17:06:40 +02:00
Danny Al-Gaaf
c266d7c7d4 mds/Server.cc: fix possible NULL pointer dereference
Add asserts to solve these CID issues:

CID 717002 (#1 of 2): Dereference null return value (NULL_RETURNS)
  dereference: Dereferencing a pointer that might be null "dir"
  when calling "CDir::lookup(std::string const &, snapid_t)".
CID 717002 (#2 of 2): Dereference null return value (NULL_RETURNS)
  dereference: Dereferencing a pointer that might be null "dir"
  when calling "CDir::lookup(std::string const &, snapid_t)".

CID 717003 (#1 of 2): Dereference null return value (NULL_RETURNS)
  dereference: Dereferencing a pointer that might be null "dn" when
  calling "operator <<(std::ostream &, CDentry &)"
CID 717003 (#2 of 2): Dereference null return value (NULL_RETURNS)
  dereference: Dereferencing a pointer that might be null "straydn"
  when calling "CDentry::push_projected_linkage()".

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-05-22 15:45:22 +02:00
Danny Al-Gaaf
fd818a20c3 src/rbd.cc: silence CID COPY_PASTE_ERROR warning
CID 1021212 (#1 of 1): Copy-paste error (COPY_PASTE_ERROR)
  copy_paste_error: "r" in "r = -*__errno_location()" looks like
  a copy-paste error. Should it say "fd" instead?

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-05-22 15:45:18 +02:00
Danny Al-Gaaf
fa3149d21e mds/MDS.cc: fix dereference null return value
Fix for:

returned_null: Function "SessionMap::get_session(entity_name_t)" returns
  null (checked 12 out of 14 times)

CID 739601 (#1 of 1): Dereference null return value (NULL_RETURNS)
  dereference: Dereferencing a pointer that might be null
  "this->sessionmap.get_session(entity_name_t::CLIENT(client.v))" when
  calling "MDS::send_message_client_counted(Message *, Session *)"

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-05-22 15:42:52 +02:00
Danny Al-Gaaf
711810870e mds/MDCache.cc: fix possible NULL pointer dereference
Assert if 'cur' is NULL.

CID 966616 (#1 of 1): Dereference null return value (NULL_RETURNS)
  dereference: Dereferencing a pointer that might be null "cur" when
  calling "CInode::is_dir()".

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-05-22 15:38:26 +02:00
Joao Eduardo Luis
2ff23fe784 mon: Paxos: finish_proposal() when we're finished recovering
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
2013-05-22 13:33:34 +01:00
Dan Mick
f70d463c25 wip: ceph: print help for osd.0, mon.a, mds.a daemon commands
Issues:
1) ignore commands with no help text, as does daemon help?
2) come up with daemon names from running config somehow
3) do we *want* to do all, always?  Maybe

	--help	for 'normal' mon commands, mon daemon commands
	--help-osd for osd tell, pg, osd daemon commands
	--help-mds for mds daemon commands
	--help-all for all the above
?

Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-22 00:14:00 -07:00
Dan Mick
34c42f652b ceph: admin_socket() returns data rather than printing.
Preparation for use in daemon command validation/help enumeration

Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-22 00:10:23 -07:00
Dan Mick
06a156df0c admin_socket and all users: command-descriptor support
add cmddesc to all register_command calls, and add a class and
command to return all the command descriptors as is done for
monitor, osd tell, and pg pgid commands.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-22 00:08:58 -07:00
Dan Mick
27b60d822f Makefile.am: Move cmdparse to libcommon
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-22 00:06:44 -07:00
Dan Mick
ed3152457c rados.py, ceph: add timeout for run_in_thread and selected callers
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 20:57:12 -07:00
Dan Mick
70a96973e9 packaging fixes around the new ceph cli:
Remove ceph-legacy-cli
Include ceph in proper places to get it built/installed/packaged
Make ceph-common (deb) or ceph (rpm) pkg depend on python-ceph pkg

Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 20:33:23 -07:00
Dan Mick
7e6c461135 ceph: handle our own help printing
We want to see helptext from mon commands and osd commands (and,
eventually, daemon commands), and so we'll need to make several
calls for the command descriptors before we have all the help.
Wait until we know we've been asked for help before taking the
multiple-connection hit.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:38:00 -07:00
Dan Mick
bf6220e1ae mon: Merge in (and add COMMAND() for) compact command
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:38:00 -07:00
Dan Mick
948d396ab9 ceph: handle non-EINVAL failure on get_command_descriptions
Treat as a fatal error, and report it.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:38:00 -07:00
Dan Mick
d302761048 objecter: allow osd-destined commands to fail if osd doesn't exist
Return ENXIO instead of EINVAL, mostly because EINVAL is overused, but
also because we need to distinguish between this sort of failure
on 'get_command_descriptions' and 'old OSD'.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:38:00 -07:00
Dan Mick
a9b4f46f51 mon: fix stdout vs. stderr throughout monitor
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:38:00 -07:00
Dan Mick
de1b8557cd librados, rados.py: rados_*_command: pass inbuflen to handle zeroes
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:38:00 -07:00
Dan Mick
5225028a44 osd: handle new-style JSON commands directly (like mon)
'tell osd.n' and 'pg <pgid>' commands go directly to the OSD.
Both are enumerated in osd_commands[]; that could be cleaner but
it doesn't seem worth the effort.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:38:00 -07:00
Dan Mick
c3f6e64c99 mon, cmdparse: move dump_cmds_to_json to common/cmdparse
Also include ARRAY_SIZE macro

Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:38:00 -07:00
Dan Mick
623d6302e0 ceph: cleanup: remove dead code/imports, note apparently-unused objects
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:38:00 -07:00
Dan Mick
a568be8352 ceph: hack for tell so that we don't have to duplicate "tell <target>"
in each command description

Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:38:00 -07:00
Dan Mick
a502daa195 ceph: figure out which daemon should get a command early
Before even asking for a list of valid command signatures, do some fixed
parsing to figure out which daemon we should ask (and eventually send
the command to).  For pg commands, just let the objecter's pg_command
figure out where they should go.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:38:00 -07:00
Dan Mick
9a08573708 ceph: add partial to validate()
Allow validation of the front of a command, to precalculate the
target for a command (basically, whether it's a 'normal' monitor
command, a "tell <osd>" command, or a "pg <pgid>" command; the latter
two go to the OSD, and so the OSD needs to be consulted for valid
command lists *and* receive the command directly.  This means we
have to have some fixed preclassification of the command, which
is done with validate(partial=True).

Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:38:00 -07:00
Dan Mick
aa7f52fb24 ceph: move parsing of a json funcsig into function for reusability
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:37:59 -07:00
Dan Mick
26df7ace9d ceph: allow CephName to validate when given only an 'id'
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:37:59 -07:00
Dan Mick
2a663a940d rados.py: no exception on error, just return errno to caller
also fix up a comment

Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:37:59 -07:00
Dan Mick
0b9601d592 MonmapMonitor: use parsed destination for mon tell
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:37:59 -07:00
Dan Mick
fc629e6e3c MonmapMonitor: mon tell: allow 'type.id' or 'id' as well as 'n'
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:37:59 -07:00
Dan Mick
d7c6885919 ceph: send pgid in command strings of pg tell
It's also passed as part of the message, but to avoid having to
rev MCommand, just pass it in cmd there as well

Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:37:59 -07:00
Dan Mick
3ff7c364d7 ceph: return error from json_command rather than raising exception
Print outs along with error, and return errno to caller if it happens

Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:37:59 -07:00
Dan Mick
5f211ef221 ceph: clean up line wraps, comments, add verbose command output
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:37:59 -07:00
Dan Mick
95e411dcad ceph: implement -w/--watch.
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:37:59 -07:00
Dan Mick
2ce5cb7d06 rados.py: change all calls to librados to be on a child thread
Handling SIGINT while blocked in librados() requires said blocking
to not block the main Python thread, so arrange for all entries
into librados to be done on a child thread.  Loop polling join()
on that thread so that the main thread can see SIGINT.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:37:59 -07:00
Dan Mick
48490841ed rados.py: implement rados_monitor_log
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:37:59 -07:00