Tommi Virtanen [Wed, 3 Oct 2012 15:47:20 +0000 (08:47 -0700)]
ceph-disk-prepare: Avoid triggering activate before prepare is done.
Earlier testing never saw this, but now a mount of a disk triggers a
udev blockdev-added event, causing ceph-disk-activate to run even
before ceph-disk-prepare has had a chance to write the files and
unmount the disk.
Avoid this by using a temporary partition type uuid ("ceph 2 be"), and
only setting it to the permanent ("ceph osd"). The hotplug event won't
match the type uuid, and thus won't trigger ceph-disk-activate.
Tommi Virtanen [Tue, 2 Oct 2012 23:37:07 +0000 (16:37 -0700)]
ceph-disk-activate: Unmount on errors (if it did the mount).
This cleans up the error handling to not leave disks mounted
in /var/lib/ceph/tmp/mnt.* when something fails, e.g. when
the ceph command line tool can't talk to mons.
Tommi Virtanen [Tue, 2 Oct 2012 23:04:15 +0000 (16:04 -0700)]
ceph-disk-prepare: Allow specifying fs type to use.
Either use ceph.conf variable osd_fs_type or command line option
--fs-type=
Default is still ext4, as currently nothing guarantees xfsprogs
or btrfs-tools are installed.
Currently both btrfs and xfs seems to trigger a disk hotplug event at
mount time, thus triggering a useless and unwanted ceph-disk-activate
run. This will be worked around in a later commit.
Currently mkfs and mount options cannot be configured.
Bug: #2549 Signed-off-by: Tommi Virtanen <tv@inktank.com>
Dan Mick [Fri, 5 Oct 2012 18:17:44 +0000 (11:17 -0700)]
rbd: set_conf_param() rewhack:
1) comment set_conf_param and the loop that uses it
2) put back error checking for "called with full param list" in macro
3) make all the loop calls consistent
4) add a third arg placeholder to handle lock remove
Signed-off-by: Dan Mick <dan.mick@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Dan Mick [Fri, 5 Oct 2012 00:52:05 +0000 (17:52 -0700)]
rbd: gracefully handle extra arguments
Instead of looping across all args, with increments inside the loop,
which can run off the end of the vector, demand that the final
argument parsing have exactly the right number of args, or complain
about the extras and die.
Signed-off-by: Dan Mick <dan.mick@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Josh Durgin [Thu, 4 Oct 2012 23:50:42 +0000 (16:50 -0700)]
qa: report success if race is not detected
This test still verifies that the race is handled correctly if it
occurs, but will no longer clutter test results with spurious failures
when the race is not reproduced.
Sean Channel [Wed, 3 Oct 2012 21:02:55 +0000 (14:02 -0700)]
admin/build-doc: Use installed Sphinx and its dependencies, when possible.
This avoids the delay of installing Sphinx inside the virtualenv;
especially, compiling lxml is slow.
If Sphinx is not installed system-wide (or it's too old), this will
still install a copy inside the virtualenv, to keep working.
Thanks to Sean for the push to make this happen, and testing the
various scenarios; I (Tv) took the liberty of changing the commit to
use venv-python for the manpage build too, avoid the nonstandard
"which" command, be more careful about quoting, and explain more fully
what's going on in the comment.
Closes: https://github.com/ceph/ceph/pull/24 Signed-off-by: Sean Channel <pentabular@gmail.com> Signed-off-by: Tommi Virtanen <tv@inktank.com>
We should never consider old 'acks' from monitors on a new election. We
usually do it, but we didn't if an election expired, because this code
didn't foresee the possibility of monitors changing ranks in-between
elections -- which doesn't happen if we specify the monmap during the
monitor's mkfs, but may happen when relying on 'mon initial peers'.
Failing to do so triggered an assertion after fixing bug #3252.
Backport: argonaut
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com> Signed-off-by: Sage Weil <sage@inktank.com>
mon: Elector: bootstrap on new monmap from elector
Whenever we update the monmap we should bootstrap, in order to reset the
monitor's on-going activities and re-probe.
Not doing so contributed to bug #3252, during which we entered an infinite
election cycle. This may only happen though when we rely on 'mon initial
peers'. Specifying a monmap during the monitor's mkfs should not trigger
this bug.
Fixes: #3252
Backport: argonaut
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com> Signed-off-by: Sage Weil <sage@inktank.com>
Sam Lang [Sat, 29 Sep 2012 02:26:16 +0000 (19:26 -0700)]
client: Fix #2215 with cache inval in thread
The client currently deadlocks with kernel buffer cache invalidation
enabled, due to the client lock calling the invalidate callback, which
in turn sends up calls back to the userspace process which try to lock
the same client lock. The fix is to invoke the invalidate callback in
a separate thread, allowing _release, _flushed, etc. to complete,
unlocking the client lock so that the invalidate callback avoids deadlock
when the up call is made.
We construct a separate work queue (Finisher) that allows scheduling
the invalidate callbacks in a separate thread. The thread only starts
when the invalidate callback is set. If no callback is set, the cache
capability reference is decremented inline as before.
Some callers of invalidate_inode_cache (flush and update_inode_file_bits)
don't expect the cache capability to be decremented. Pass a keep_caps flag to
only decrement the capability ref in the _release case.
Also, we need to make sure the mds is aware that the client has dropped
the cache capability, so we add a call to check_caps in put_cap_ref for the
CEPH_CAP_FILE_CACHE capability.
Sage Weil [Wed, 3 Oct 2012 16:12:40 +0000 (09:12 -0700)]
mds: make migrate_stray() specify full path
The handle_client_rename() check expects a full path rooted in the MDSDIR.
Do so in migrate_stray().
Also, use the committed (not projected) dn linkage; this was a carry-over
from the original switch to this API forever ago, but the current callers
don't need to migrate an uncommitted stray. This also aligns us with
reintegrate_stray().
Reported-by: Yan, Zheng <zheng.z.yan@intel.com> Signed-off-by: Sage Weil <sage@inktank.com>
Sage Weil [Wed, 3 Oct 2012 15:23:08 +0000 (08:23 -0700)]
mds: fix stray reintegration check in handle_client_rename
The stray reintegration generates a source path that will be rooted in a
(possibly remote) MDS's MDSDIR; adjust this check accordingly. This is a
holdover from way back when the straydir was the base of the tree instead
of mdsdir.
Reported-by: Yan, Zheng <zheng.z.yan@intel.com> Signed-off-by: Sage Weil <sage@inktank.com>
Yan, Zheng [Tue, 2 Oct 2012 08:55:52 +0000 (16:55 +0800)]
mds: Avoid creating unnecessary snaprealm
When moving directory between snaprealms, we can avoid creating snaprealm
if the directory doesn't has its own snaprealm and directory was created
after both realms' newest snapshot.
Sam Lang [Tue, 2 Oct 2012 15:43:05 +0000 (10:43 -0500)]
client: Resolves coverity NULL dereference issue
Client::insert_trace() was handling readdir and lssnap replies
assuming that the directory inode was not null. This commit
checks that the directory inode (returned as part of the trace)
is not null, and invokes insert_readdir_results() for the readdir
and lssnap replies.
Signed-off-by: Sam Lang <sam.lang@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
Sage Weil [Tue, 2 Oct 2012 04:02:43 +0000 (21:02 -0700)]
filestore: check ioctl SYNC return code
CID 716860: Unchecked return value (CHECKED_RETURN)
At (22): Calling function "ioctl(int, unsigned long, ...)" without checking return value (as is done elsewhere 30 out of 31 times).
Samuel Just [Mon, 1 Oct 2012 22:23:00 +0000 (15:23 -0700)]
FileStore: copy paste error _do_copy_range
CID 728419: Copy-paste error (COPY_PASTE_ERROR)At (2): "srcoff" in "actual !=
(int64_t)srcoff" looks like a copy-paste error. Should it say "dstoff" instead?
Sage Weil [Mon, 1 Oct 2012 03:50:16 +0000 (20:50 -0700)]
filestore: check lseek64 return value
CID 716862: Other violation (CHECKED_RETURN)
At (3): Calling function "lseek64(to, dstoff, 0)" without checking return value. This library function may fail and return an error code.
Sage Weil [Mon, 1 Oct 2012 03:48:18 +0000 (20:48 -0700)]
filestore: check ioctl WAIT_SYNC return value
CID 716860: Unchecked return value (CHECKED_RETURN)
At (27): Calling function "ioctl(int, unsigned long, ...)" without checking return value (as is done elsewhere 29 out of 31 times).
Sage Weil [Mon, 1 Oct 2012 03:46:37 +0000 (20:46 -0700)]
filejournal: check lseek64 return value
CID 716858: Other violation (CHECKED_RETURN)
At (6): Calling function "lseek64(this->fd, pos, 0)" without checking return value. This library function may fail and return an error code.
Sage Weil [Mon, 1 Oct 2012 03:44:17 +0000 (20:44 -0700)]
mon/PGMap: fix nearfull check
CID 716881: Copy-paste error (COPY_PASTE_ERROR)
At (2): "full_ratio" in "inc.full_ratio" looks like a copy-paste error. Should it say "nearfull_ratio" instead?
Sage Weil [Sat, 29 Sep 2012 08:32:08 +0000 (01:32 -0700)]
mdsmap: init fields in ctor
At (2): Non-static class member "session_timeout" is not initialized in this constructor nor in any functions that it calls.
At (4): Non-static class member "session_autoclose" is not initialized in this constructor nor in any functions that it calls.
At (6): Non-static class member "max_file_size" is not initialized in this constructor nor in any functions that it calls.
CID 717238: Uninitialized scalar field (UNINIT_CTOR)
At (8): Non-static class member "max_mds" is not initialized in this constructor nor in any functions that it calls.
Sage Weil [Sat, 29 Sep 2012 08:30:35 +0000 (01:30 -0700)]
mds: fix potential overflow
CID 717014: Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
At (1): Potentially overflowing expression "in->inode.layout.fl_object_size.operator unsigned int() * in->inode.layout.fl_stripe_count.operator unsigned int()" with type "unsigned int" (32 bits, unsigned) is evaluated using 32-bit arithmetic before being used in a context which expects an expression of type "uint64_t" (64 bits, unsigned). To avoid overflow, cast either operand to "uint64_t" before performing the multiplication.
Sage Weil [Sat, 29 Sep 2012 08:29:49 +0000 (01:29 -0700)]
mds: init atid in context
CID 717236: Uninitialized scalar field (UNINIT_CTOR)
At (2): Non-static class member "atid" is not initialized in this constructor nor in any functions that it calls.
Sage Weil [Sat, 29 Sep 2012 08:29:00 +0000 (01:29 -0700)]
mds: init log layout in MDCcahe ctor
CID 717237: Uninitialized scalar field (UNINIT_CTOR)
At (8): Non-static class member field "default_file_layout.fl_stripe_unit" is not initialized in this constructor nor in any functions that it calls.
At (10): Non-static class member field "default_file_layout.fl_stripe_count" is not initialized in this constructor nor in any functions that it calls.
At (12): Non-static class member field "default_file_layout.fl_object_size" is not initialized in this constructor nor in any functions that it calls.
At (14): Non-static class member field "default_file_layout.fl_cas_hash" is not initialized in this constructor nor in any functions that it calls.
At (16): Non-static class member field "default_file_layout.fl_object_stripe_unit" is not initialized in this constructor nor in any functions that it calls.
At (18): Non-static class member field "default_file_layout.fl_unused" is not initialized in this constructor nor in any functions that it calls.
At (20): Non-static class member field "default_file_layout.fl_pg_pool" is not initialized in this constructor nor in any functions that it calls.
At (21): Non-static class member field "default_log_layout.fl_stripe_unit" is not initialized in this constructor nor in any functions that it calls.
At (22): Non-static class member field "default_log_layout.fl_stripe_count" is not initialized in this constructor nor in any functions that it calls.
At (23): Non-static class member field "default_log_layout.fl_object_size" is not initialized in this constructor nor in any functions that it calls.
At (24): Non-static class member field "default_log_layout.fl_cas_hash" is not initialized in this constructor nor in any functions that it calls.
At (25): Non-static class member field "default_log_layout.fl_object_stripe_unit" is not initialized in this constructor nor in any functions that it calls.
At (26): Non-static class member field "default_log_layout.fl_unused" is not initialized in this constructor nor in any functions that it calls.
At (27): Non-static class member field "default_log_layout.fl_pg_pool" is not initialized in this constructor nor in any functions that it calls.
Sage Weil [Sat, 29 Sep 2012 08:27:33 +0000 (01:27 -0700)]
mds: simplify get_dirfrag()
Avoid useless have_inode() call.
CID 716996: Dereference null return value (NULL_RETURNS)
At (13): Dereferencing a pointer that might be null "this->get_inode(df.ino, snapid_t(18446744073709551614UL))" when calling "CInode::get_dirfrag(frag_t)". [hide details]
Sage Weil [Sat, 29 Sep 2012 08:17:21 +0000 (01:17 -0700)]
mds: add assert to lock path
This makes coverity happy:
CID 716916: Explicit null dereferenced (FORWARD_NULL)
At (28): Passing null pointer "in" to function "MDSCacheObject::state_test(unsigned int) const", which dereferences it. [hide details]
Sage Weil [Sat, 29 Sep 2012 08:16:16 +0000 (01:16 -0700)]
mds: fix uninit Dumper fields in ctor
CID 717234: Uninitialized pointer field (UNINIT_CTOR)
At (8): Non-static class member "rank" is not initialized in this constructor nor in any functions that it calls.
Sage Weil [Sat, 29 Sep 2012 08:12:53 +0000 (01:12 -0700)]
mds: fix uninit Capability::last_issue
CID 717233: Uninitialized scalar field (UNINIT_CTOR)
At (2): Non-static class member "last_issue" is not initialized in this constructor nor in any functions that it calls.
Sage Weil [Sat, 29 Sep 2012 08:11:41 +0000 (01:11 -0700)]
mds: fix uninit field in CInode
CID 717231: Uninitialized scalar field (UNINIT_CTOR)
At (3): Non-static class member "auth_pin_freeze_allowance" is not initialized in this constructor nor in any functions that it calls.