Commit Graph

39648 Commits

Author SHA1 Message Date
Josh Durgin
1f9782ea3c librbd: move object_map_lock acquisition into refresh()
Every caller was acquiring this just for these calls.

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
2015-02-25 17:40:25 -08:00
Josh Durgin
27e5ae603b librbd: don't check if object map is enabled before refreshing
This check is now done internally by the object map.

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
2015-02-25 17:27:34 -08:00
Josh Durgin
876f128f8b librbd: remove object map on rollback if needed
When rolling back to a snapshot that did not have object map enabled,
delete the head object map.

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
2015-02-25 17:27:34 -08:00
Josh Durgin
f4d8d16fbb librbd: clarify md_lock usage
Signed-off-by: Josh Durgin <jdurgin@redhat.com>
2015-02-25 17:27:34 -08:00
Josh Durgin
01dc05b931 test_librbd: add simple test for object map snapshot consistency
Signed-off-by: Josh Durgin <jdurgin@redhat.com>
2015-02-25 17:27:34 -08:00
Josh Durgin
85825008bc librbd: use snap_lock to protect ImageCtx->size
Since this is often looked up by snap_id anyway, snap_lock
is easy to use for this.

This lets us avoid taking md_lock in many places.

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
2015-02-25 17:27:34 -08:00
Josh Durgin
7fed0a366d librbd: hold snap_lock while reading parent info in diff_iterate
Caught be the re-added assertions in ImageCtx::get_parent_info()

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
2015-02-25 17:27:34 -08:00
Josh Durgin
df42fd3833 test_librbd: close ioctx after imagectx
There's no need to explicitly close the ioctx. Doing so may cause
problems when the Images using it are destroyed afterwards.  Just let
normal cleanup at the end of the block take care of it in the correct
order.

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
2015-02-25 17:27:33 -08:00
Josh Durgin
06e5a3979f rbd: fix --image-feature parsing
Need to use _witharg(), not _flag()

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
2015-02-25 17:27:33 -08:00
Josh Durgin
eef7466a5c librbd: apply flag read failure to all snaps
Don't check just the features of head, since it may be possible to
disable object map in the future.

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
2015-02-25 17:27:33 -08:00
Josh Durgin
6ac8139b25 librbd: make ImageCtx->object_map always present
This simplifies locking by obviating the NULL checks.  We no longer
need md_lock to protect these acceses. We can use object_map_lock
instead, to make sure no one reads an object map while its being
updated.

Keep track of whether the object map is enabled for a given snapshot
internally. In each public method, check this state, and automatically
set it correctly when refreshing the object map. During snapshot
removal, unconditionally try to remove the object map object, to
protect against bugs leaking objects, and to be consistent with image
removal.

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
2015-02-25 17:27:33 -08:00
Jason Dillaman
d611121ad7 tests: add unit test to verify async requests time out
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2015-02-25 20:00:54 -05:00
Jason Dillaman
c29548519e librbd: restart async requests if lock owner doesn't report progress
Detect the case of a crashed lock owner by waiting for up to 30 seconds
for a async request progress message from the leader.  If a progress
message isn't received, restart the request (and possibly take ownership
of the lock).

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2015-02-25 19:51:07 -05:00
Jason Dillaman
c611936c83 librbd: replace Finisher/SafeTimer use with facade
Replace the two Context threading classes used within
ImageWatcher with a facade to orchestrate the scheduling
and canceling of Context task callbacks.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2015-02-25 19:51:07 -05:00
Jason Dillaman
41e186a24f librbd: cancel in-progress maint operations before releasing lock
Ensure that all in-flight maintenance operations (resize, flatten) are
not running when the exclusive lock is released.  The lock will be
released when transitioning to a snapshot, closing the image, or
cooperatively when another client requests the lock.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2015-02-25 19:51:07 -05:00
Jason Dillaman
dde882cd7a librbd: flush context potentially completing too early
If the async operation associated with a flush request completes,
only complete the flush contexts if no previous operations are
still in flight. Otherwise, move the flush contexts to an older
in-flight async operation.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2015-02-25 19:51:07 -05:00
Josh Durgin
17493d648f Merge pull request #3799 from ceph/wip-librbd-image-watcher-tests
tests: add additional test coverage for ImageWatcher RPC

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
2015-02-25 16:42:46 -08:00
Josh Durgin
04d360a4c1 librbd: take ImageCtx->snap_lock for write in add_snap()
add_snap() updates the ImageCtx snapshot metadata in memory, as well
as reading the flags as part of the object map snapshot. Both of these
require holding snap_lock.

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
2015-02-25 15:42:32 -08:00
Josh Durgin
40c2abb08a librbd: use snap_lock to protect ImageCtx->flags
This is another step towards eliminating md_lock from the writeback
path. Almost all the places that use ImageCtx->flags already use
snap_lock, so there's no need to create a new lock. For the others,
add a helper, test_flags() that acquires the lock, similar to
test_features().

This also makes sure we look up flags of the snapshot we're operating
on, instead of those for head.

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
2015-02-25 15:42:31 -08:00
Josh Durgin
bb4041fc95 librbd: add locking asserts to ImageCtx
A bunch of these used to be here, but were removed when converting to
RWLocks, before RWLocks had is_[w]locked() methods.

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
2015-02-25 15:41:54 -08:00
Josh Durgin
4bcbdbfd0f librbd: fix ImageWatcher::is_lock_supported() locking
Take snap_lock while reading ImageCtx->snap_id, and
look up the features by snap_id as well.

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
2015-02-25 15:41:54 -08:00
Josh Durgin
a94ceb6088 librbd: add and use a test_features() helper
This gets the appropriate locks, and checks the currently open
snapshot instead of head.  Looking up features by snap_id prepares us
for future addition or removal of e.g. an object map throughout the
life of an image.

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
2015-02-25 15:41:54 -08:00
Josh Durgin
cffd93a32f librbd: use ImageCtx->snap_lock for ImageCtx->features
This was being protected by md_lock, but that has become too coarse
since it is used to prevent writes from proceeding while flushing
caches for a snapshot. With the addition of ObjectMap and
ImageWatcher, writeback could try to acquire md_lock again, leading to
a deadlock.

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
2015-02-25 15:41:50 -08:00
Jason Dillaman
468839eac9 tests: add additional test coverage for ImageWatcher RPC
Test flatten, resize, and snap create RPC messages along with
basic error code return paths.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2015-02-25 15:03:49 -05:00
Jason Dillaman
915064a732 librbd: add ostream formatter for NotifyOp
Allow for reuse of the NotifyOp to string conversions within
dencoder and tests.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2015-02-25 14:58:27 -05:00
Greg Farnum
260c8201a8 fuse: do not invoke ll_register_callbacks() on finalize
We were passing in a NULL data structure, probably in an attempt to
let things clean up -- but our implementation just returns with a NULL
pass-in value, so drop it for clarity.

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
2015-02-25 11:24:52 -08:00
Gregory Farnum
93e04a04a6 Merge pull request #3794 from ceph/wip-10862-hammer
Backport: mon: do not try and "deactivate" the last MDS
2015-02-25 11:07:59 -08:00
Ken Dreyer
05a4d6b492 Merge pull request #3788 from ceph/wip-devel-python-split
split python-ceph into python-{rados,rbd,cephfs}

Reviewed-by: Ken Dreyer <kdreyer@redhat.com>
2015-02-25 12:00:43 -07:00
John Spray
75d8c01179 mon: do not try and "deactivate" the last MDS
Fixes: #10862
Signed-off-by: John Spray <john.spray@redhat.com>
(cherry picked from commit a2867987bc)
2015-02-25 14:12:31 +00:00
Boris Ranto
a79e9056cb qa: fix python-ceph reference
Signed-off-by: Boris Ranto <branto@redhat.com>
2015-02-24 18:30:18 -08:00
Boris Ranto
46b45e3fc2 doc: fix python-ceph refs in docs
Signed-off-by: Boris Ranto <branto@redhat.com>
2015-02-24 18:30:18 -08:00
Boris Ranto
d1c82ea9f4 ceph.spec: specify version
Signed-off-by: Boris Ranto <branto@redhat.com>
2015-02-24 18:30:18 -08:00
Sage Weil
2a23eac549 debian: split python-ceph
- move argparse to ceph-common
- split out rados, rbd, and cephfs bindings into their own packages
- keep python-ceph as a metapackage

Signed-off-by: Sage Weil <sage@redhat.com>
2015-02-24 18:30:18 -08:00
Boris Ranto
39982b10ad Split python-ceph to appropriate python-* packages
python-ceph contains various header files/bindings for serveral
libraries, this patch creates *-devel packages for all the
libraries separately and provides the compatibility layer for
the split.

Signed-off-by: Boris Ranto <branto@redhat.com>
2015-02-24 12:50:27 -08:00
Samuel Just
29861b1b64 Merge pull request #3742 from ceph/wip-10788
osd: proxy features with proxied reads; only proxy reads to new peers

Reviewed-by: Samuel Just <sjust@redhat.com>
2015-02-24 11:15:06 -08:00
Josh Durgin
3857228ac9 Merge pull request #3786 from ceph/wip-librbd-python-tests
tests: speed up Python RBD random data generation

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
2015-02-24 08:45:48 -08:00
Jason Dillaman
bd40f23d7d tests: speed up Python RBD random data generation
The RBD large_write test cases was taking multiple minutes to
run under a Fedora 21 VM.  Replaced the million+ random number
generator calls with a single call to os.urandom. The test
now completes within seconds.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2015-02-24 09:25:14 -05:00
Josh Durgin
c1c38afcf9 Merge pull request #3780 from ceph/wip-osdc-watch-error
osdc: watch error callback invoked on cancelled context

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
2015-02-23 17:21:04 -08:00
Josh Durgin
e332d84efc Merge pull request #3781 from ceph/wip-librbd-image-watcher-tests
tests: fix potential race conditions in test_ImageWatcher

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
2015-02-23 17:20:52 -08:00
Jason Dillaman
655e616249 tests: fix potential race conditions in test_ImageWatcher
The tests were sending invalid responses back to ImageWatchers
(missing the result code), which had the potential to allow the
lock to be acquired sooner than the test was expecting since
ImageWatcher would assume the last of response code meant no
clients owned the exclusive lock and would retry as fast as
possible.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2015-02-23 20:09:56 -05:00
Jason Dillaman
9c03750acd osdc: watch error callback invoked on cancelled context
The C_DoWatchError context did not verify whether or not the
watch was cancelled prior to invoking the callback.  This
resulted in sporadic crashes when reconnect errors bubbled
up to destroyed objects.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2015-02-23 20:00:43 -05:00
Josh Durgin
11f8cd81da Merge pull request #3779 from liewegas/wip-watch-timeout-test
make watch timeout test less likely to fail under thrashing

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
2015-02-23 14:51:49 -08:00
Sage Weil
a9bfd5ddda ceph_test_rados_api_watch_notify: wait longer for watch timeout
OSD thrashing can delay this indefinitely; longer delay means lower
probability of that happening.

Signed-off-by: Sage Weil <sage@redhat.com>
2015-02-23 14:46:16 -08:00
Sage Weil
91cda52c10 osd: better debug for maybe_handle_cache
Signed-off-by: Sage Weil <sage@redhat.com>
2015-02-23 10:10:54 -08:00
Sage Weil
bee91548b0 osd,mon: explicitly specify OSD features in MOSDBoot
We are using the connection features to populate the features field in the
OSDMap, but this is the *intersection* of mon and osd features, not the
osd features.  Fix this by explicitly specifying the features in
MOSDBoot.

Fixes: #10911
Backport: giant, firefly
Signed-off-by: Sage Weil <sage@redhat.com>
2015-02-23 10:10:54 -08:00
Sage Weil
30c904ea67 osd: do not proxy reads unless all OSDs proxy features too
Specifically, the object_copy_data_t encoding changed such that the reply
encoding is dependent on features; if we proxy such a read to an old
OSD it will use *our* features to encode instead of the original OSD's.

This effectively conditionally reverts 8e145e08ed
when the cluster features aren't all present.

Fixes: #10788
Signed-off-by: Sage Weil <sage@redhat.com>
2015-02-23 10:10:54 -08:00
Sage Weil
e0e765f9dd osd/OSDMap: cache get_up_osd_features
This method is O(n) and called from in a few places for each IO operation.
Cache the value since it does not change over the lifetime of a single
epoch.  Invalidate on apply_incremental() and decode.

Signed-off-by: Sage Weil <sage@redhat.com>
2015-02-23 10:10:54 -08:00
Josh Durgin
e1f2c97256 Merge pull request #3777 from ceph/wip-librbd-snap-create-race
librbd: fixed snap create race conditions

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
2015-02-23 10:00:01 -08:00
Jason Dillaman
63f6c9bac9 librbd: fixed snap create race conditions
Since the post-snap create header update runs asynchrously
in a finalizer callback, it's possible that the snapshot
is not immediately visible.  Also, if a proxied snap create
message is replayed, it's possible for the client to receive
a EEXISTS error.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2015-02-23 12:46:33 -05:00
Josh Durgin
da1ed53987 Merge pull request #3758 from ceph/wip-10898
librbd: improved ImageWatcher duplicate message detection

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
2015-02-23 09:08:11 -08:00