Commit Graph

1605 Commits

Author SHA1 Message Date
Jason Dillaman
8f035924a7 Merge pull request #11808 from trociny/wip-17010
librbd: default features should be negotiated with the OSD

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-11-15 08:36:51 -05:00
Jason Dillaman
4c3056e94d Merge pull request #11821 from trociny/wip-test_notify
test/librbd: in test_notify set object-map and fast-diff features by default

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-11-15 08:35:40 -05:00
Kefu Chai
8eb2c9d1bd cmake:librbd: move common to the end of linked libraries
so the linked libraries are able to find the symbols in libcommon.
and do not `list(APPEND librbd ...)` anymore, which is wrong and not
necessary. librbd does not depends on krbd.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-11-14 18:38:55 +08:00
Kefu Chai
9f8a311ced cmake: move ContextCompletion.cc into rbd_internal
- ContextCompletion.cc is used by TrimRequest.cc which is included by
  rbd_internal, it's more natural to put ContextCompletion.cc into
  rbd_internal also. as rbd_internal is the only consumer of this
  translation unit.
- librbd/internal.cc is not referencing any symbols from util.cc, so
  remove this include. and also, do not add
  $<TARGET_OBJECTS:common_util_obj> to librbd.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-11-14 18:38:55 +08:00
Kefu Chai
89d6091535 cmake: let rbd_internal depend on librbd-tp
as librbd/AioCompletion.cc includes "tracing/librbd.h", which is offered
by librbd-tp.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-11-14 18:38:55 +08:00
Mykola Golub
ef05afb80a librbd: release lock after demote
Fixes: http://tracker.ceph.com/issues/17880
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-11-12 14:23:20 +02:00
Danny Al-Gaaf
05a593d42f librbd/WatchNotifyTypes.h: init member vars in ctor
Fix for:

CID 1351734 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
 uninit_member: Non-static class member result is not initialized
  in this constructor nor in any functions that it calls.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2016-11-09 14:45:22 -05:00
Danny Al-Gaaf
da9ede90cd librbd/exclusive_lock/AcquireRequest.cc: init lock_type
Fixup for:

CID 1351687 (#1 of 1): Uninitialized scalar variable (UNINIT)
 var_decl: Declaring variable lock_type without initializer
 uninit_use: Using uninitialized value lock_type.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2016-11-09 14:44:57 -05:00
Mykola Golub
99ce7afaf4 librbd: debug: don't log uint8_t image create options as chars
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-11-08 10:24:49 +02:00
Mykola Golub
f066ce8f80 librbd: default features should be negotiated with the OSD
Fixes: http://tracker.ceph.com/issues/17010
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-11-07 20:13:00 +02:00
Jason Dillaman
5e03f4880b Merge pull request #11510 from vshankar/wip-17356
librbd: batch object map updates during trim

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-11-05 13:15:27 -04:00
Jason Dillaman
8adf3848ef Merge pull request #11766 from trociny/wip-rbd-info-fix-upgrade-client
librbd: snap_get_limit compatibility check

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-11-05 13:15:08 -04:00
Jason Dillaman
740ac0581b Merge pull request #11744 from trociny/wip-16962
rbd-mirror: snap protect of non-layered image results in split-brain

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-11-04 08:53:51 -04:00
Jason Dillaman
ff00d41275 Merge pull request #11755 from trociny/wip-17791
librbd: proper check for get_data_pool compatibility

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-11-04 08:52:54 -04:00
Mykola Golub
c1f374ef6c librbd: snap_get_limit compatibility check
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-11-03 18:36:04 +02:00
Mykola Golub
9933e0df1f Merge pull request #11704 from dillaman/wip-17752
librbd: do not create empty object map object on image creation

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-11-03 15:59:49 +02:00
Mykola Golub
5577ada030 librbd: proper check for get_data_pool compatibility
Fixes: http://tracker.ceph.com/issues/17791
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-11-03 15:27:14 +02:00
Venky Shankar
05653b7c51 librbd: batch ObjectMap updations upon trim
Shrinking a clone which has snapshots and does not share
majority of objects with its parent (i.e., there are less
objects to be copied up) involves huge number of object
map updates -- two (pre, post) per object. This results
in lots of requests to be send to OSDs especially when
trimming a gigantus image. This situation can be optimized
by sending batch ObjectMap updates for an object range
thereby significantly cutting down OSD traffic resulting
in faster trim times.

Fixes: http://tracker.ceph.com/issues/17356
Signed-off-by: Venky Shankar <vshankar@redhat.com>
2016-11-03 08:53:55 +05:30
Mykola Golub
8e1cc88e06 rbd-mirror: snap protect of non-layered image results in split-brain
Fixes: http://tracker.ceph.com/issues/16962
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-11-02 12:43:45 +02:00
Mykola Golub
478d666a89 Merge pull request #11568 from dillaman/wip-17588
librbd: cannot access non-primary image when mirroring force disabled

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-11-01 12:37:01 +02:00
Mykola Golub
7b7d0984f0 Merge pull request #11559 from dillaman/wip-17618
librbd: exclusive lock incorrectly initialized when switching to head revision

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-11-01 09:14:07 +02:00
Mykola Golub
ef4f128a26 Merge pull request #11623 from dillaman/wip-cls-rbd-group
librbd: ensure consistency groups will gracefully fail on older OSDs

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-11-01 09:13:23 +02:00
Jason Dillaman
7e27861364 librbd: do not create empty object map object on image creation
Fixes: http://tracker.ceph.com/issues/17752
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-10-31 12:09:08 -04:00
Jason Dillaman
b8589691d7 librbd: unit test cases and minor fixes for mirror::DisableRequest
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-10-31 10:57:14 -04:00
Jason Dillaman
86a0c1e5e3 librbd: restore journal access when force disabling mirroring
If mirroring is force disabled on a demoted image, the journal was
being left in an inconsistent ownership state.

Fixes: http://tracker.ceph.com/issues/17588
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-10-31 10:57:14 -04:00
Jason Dillaman
3bc9f51c58 librbd: new async journal promote state machine
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-10-31 10:57:14 -04:00
Jason Dillaman
7187383291 librbd: new async journal open state machine
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-10-31 10:57:14 -04:00
Jason Dillaman
f59f0d4955 librbd: move journal tag decode helpers to shared location
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-10-31 10:57:14 -04:00
Jason Dillaman
06a84eef70 librbd: re-add support for disabling a corrupt journal
Fixes: http://tracker.ceph.com/issues/16740
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-10-31 10:57:14 -04:00
Venky Shankar
a5fff40be3 librbd: assert failure when using data pool
This fixes a silly assert that's hit during image creation
(cli/api) when the data pool specified is same as the pool
specified by -p/--pool option (or the default).

Signed-off-by: Venky Shankar <vshankar@redhat.com>
2016-10-26 08:11:17 +05:30
Jason Dillaman
0d81674eee librbd: ensure consistency groups will gracefully fail on older OSDs
Attempting to retrieve the group spec will fail on older OSDs, so it
must be executed as an individual step in the refresh state machine.
Also fixed code style issues for out parameters.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-10-24 11:56:48 -04:00
Victor Denisov
2174751946 librbd: By default create snapshots in UserNamespace
Signed-off-by: Victor Denisov <denisovenator@gmail.com>
2016-10-21 20:53:24 -07:00
Jason Dillaman
039716db05 librbd: exclusive lock incorrectly initialized when switching to HEAD
Fixes: http://tracker.ceph.com/issues/17618
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-10-19 12:03:37 -04:00
Ved-vampir
9b8a2da190 rbd: add possibility to set rbd_default_features config option via string
Signed-off-by: Alyona Kiseleva <akiselyova@mirantis.com>
Signed-off-by: Alexey Sheplyakov <asheplyakov@mirantis.com>
2016-10-17 09:06:28 +03:00
Mykola Golub
47447bfba2 Merge pull request #11395 from dillaman/wip-17549
librbd: ignore notify errors on missing image header

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-10-11 10:55:55 +03:00
Jason Dillaman
3b81f68719 librbd: include pool id in data block prefix if data pool enabled
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-10-10 14:08:09 -04:00
Jason Dillaman
cb3712e08c librbd: initialize the data pool IO context during image open state machine
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-10-10 14:08:09 -04:00
Jason Dillaman
f5a244ae3d librbd: store data pool id with image header during creation
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-10-10 14:08:09 -04:00
Jason Dillaman
fe3e2eafa0 librbd: ignore notify errors on missing image header
The rename op on v1 images fails since the header no longer exists. In
the general case, the removal of the header object will also fail the
watcher which has its own recovery path.

Fixes: http://tracker.ceph.com/issues/17549
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-10-10 11:57:03 -04:00
Jason Dillaman
d776165f6a Merge pull request #11290 from trociny/wip-17017
rbd-mirror HA: move librbd::image_watcher::Notifier to librbd::object_watcher

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-10-10 10:41:25 -04:00
Jason Dillaman
297f21d88b Merge pull request #11260 from runsisi/wip-fix-mirror-image-disable
librbd: fix rollback if failed to disable mirroring for image

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-10-10 10:40:33 -04:00
Jason Dillaman
366e6075ca librbd: new API methods to retrieve image id and block name prefix
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-10-06 14:50:21 -04:00
Jason Dillaman
b083fa0c93 librbd: relocate image option processing to create state machine
Replace the individual image option parameters with the ImageOptions
wrapper and extract the options within the state machine itself.
This will simplify adding support for the data pool and other options
in the future.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-10-06 14:50:21 -04:00
Jason Dillaman
8b72efd181 librbd: add data pool option to API and config
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-10-06 14:50:21 -04:00
Mykola Golub
5a98a8cdef Merge pull request #11326 from dillaman/wip-17416
rbd-mirror: improve resiliency of stress test case

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-10-06 21:47:45 +03:00
Jason Dillaman
c5f2290047 librbd: new RBD_FEATURE_DATA_POOL feature bit
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-10-05 08:11:00 -04:00
Jason Dillaman
355c79cb7c librbd: ignore attempts to request lock if already lock owner
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-10-04 21:31:54 -04:00
Mykola Golub
91d7de44d9 librbd: memory leak in MirroringWatcher::notify_image_updated
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-10-04 15:54:09 +03:00
Mykola Golub
6dda2b9384 rbd-mirror HA: move librbd::image_watcher::Notifier to librbd::object_watcher
Fixes: http://tracker.ceph.com/issues/17017
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-10-04 13:51:46 +03:00
runsisi
5581510bdf librbd: fix rollback if failed to disable mirroring for image
Signed-off-by: runsisi <runsisi@zte.com.cn>
2016-10-01 13:29:23 +08:00
Mykola Golub
be25f843af rbd-mirror: replicate image metadata settings
Fixes: http://tracker.ceph.com/issues/16212
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-09-28 16:36:15 +03:00
Mykola Golub
f99dbbd153 librbd: potential null pointer dereference when requesting exclusive lock
m_require_lock_on_read should be cleared when holding owner_lock.

For safety, also check that exclusive_lock is not null.

Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-09-28 15:17:19 +03:00
Mykola Golub
ac71dbca3e librbd: interlock image state machine and update features operations
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-09-28 15:17:19 +03:00
Mykola Golub
5a68e334d8 librbd: use counter to track exclusive lock block/unblock requests
It's possible the watch/notify message is duplicated resulting in two
concurrent block_requests() call.

Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-09-28 15:17:19 +03:00
Mykola Golub
93cf63f993 rbd-mirror: replicate dynamic feature updates
Fixes: http://tracker.ceph.com/issues/16213
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-09-28 15:17:19 +03:00
Mykola Golub
3c270b57bf librbd: async state machine to enable/disable image features
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-09-28 15:17:19 +03:00
Mykola Golub
606344dd29 librbd: templetize journal StandardPolicy
It will be needed for unit tests with a mocked ImageCtx.

Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-09-28 15:17:19 +03:00
Mykola Golub
4269a5fc0c librbd: allow to call append_disabled for DisabledPolicy
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-09-28 15:17:19 +03:00
Mykola Golub
dcfb8aa141 librbd: async methods to enable/disable mirroring
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-09-28 15:17:19 +03:00
Mykola Golub
953561f841 librbd: async method to check journal tag owner
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-09-28 15:17:19 +03:00
Mykola Golub
9026b515e6 librbd: async image set flags method
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-09-28 15:17:18 +03:00
Mykola Golub
a0cf640d58 librbd: async methods to create/remove object map
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-09-28 15:17:18 +03:00
Ricardo Dias
aa959e71fe
rbd: Fix race between journal flush and append events
Signed-off-by: Ricardo Dias <rdias@suse.com>
2016-09-26 14:25:25 +01:00
Ricardo Dias
7b740f5b4a
journal: make librados call async in ObjectRecorder
Signed-off-by: Ricardo Dias <rdias@suse.com>
2016-09-26 14:25:25 +01:00
Ricardo Dias
5c88edd68a
journal: increase concurrency of journal recorder
Signed-off-by: Ricardo Dias <rdias@suse.com>
2016-09-26 10:26:21 +01:00
Jason Dillaman
fd005490e9 librbd: new journal listener event for force promotion
Fixes: http://tracker.ceph.com/issues/16974
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-09-23 09:02:41 -04:00
Jason Dillaman
39d9e5cc9b librbd: helper class for quiescing in-flight async ops
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-09-23 09:02:41 -04:00
Jason Dillaman
dbbcecf4a2 librbd: unify journal event callbacks into single interface
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-09-23 09:02:41 -04:00
Mykola Golub
ff7fda4cf1 Merge pull request #11152 from dillaman/wip-17198
librbd: potential deadlock closing image with in-flight readahead

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-09-22 16:31:57 +03:00
Mykola Golub
c4d88d4653 Merge pull request #11155 from dillaman/wip-17330
librbd: backward/forward compatibility for update_features

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-09-22 13:54:08 +03:00
Mykola Golub
83697fd5aa Merge pull request #11148 from dillaman/wip-17310
librbd: block name prefix might overflow fixed size C-string

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-09-22 13:50:03 +03:00
Jason Dillaman
5a2bccc3c0 Merge pull request #11070 from VictorDenisov/consistency_groups_extract_module
librbd: extract group module from librbd/internal

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-09-20 14:54:47 -04:00
Jason Dillaman
8cb2ccda1b librbd: update_features should handle Infernalis OSDs
Fixes: http://tracker.ceph.com/issues/17330
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-09-20 14:52:34 -04:00
Jason Dillaman
c971d58f8a librbd: potential deadlock closing image with in-flight readahead
Fixes: http://tracker.ceph.com/issues/17198
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-09-20 10:19:45 -04:00
Jason Dillaman
61734d266c librbd: block name prefix might overflow fixed size C-string
The issue which resulted in too large v2 image ids was fixed
under #16887.

Fixes: http://tracker.ceph.com/issues/17310
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-09-20 07:28:40 -04:00
Jason Dillaman
2f4d4868e3 librbd: corrected use-after-free in ImageWatcher
Fixes: http://tracker.ceph.com/issues/17289
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-09-17 08:29:15 -04:00
Victor Denisov
36d2d8a7d9 librbd: Extract Group module from librbd/internal
Signed-off-by: Victor Denisov <denisovenator@gmail.com>
2016-09-15 13:40:15 -07:00
Mykola Golub
30bbe656a4 Merge pull request #11044 from dillaman/wip-17227
librbd: ignore partial refresh error when acquiring exclusive lock

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-09-12 12:10:21 +03:00
Mykola Golub
d141b1382a Merge pull request #11037 from dillaman/wip-17254
librbd: possible deadlock if cluster connection closed after image

Reviewed-by: Xiaoxi Chen <xiaoxchen@ebay.com>
Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-09-12 12:08:46 +03:00
Jason Dillaman
24396dcba7 librbd: ignore partial refresh error when acquiring exclusive lock
Fixes: http://tracker.ceph.com/issues/17227
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-09-11 09:08:41 -04:00
Jason Dillaman
818c2f2abc librbd: possible deadlock if cluster connection closed after image
Fixes: http://tracker.ceph.com/issues/17254
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-09-10 13:43:02 -04:00
Mykola Golub
864f2acb11 Merge pull request #11034 from dillaman/wip-17251
librbd: potential seg fault when blacklisting an image client

Reviewed-by: Venky Shankar <vshankar@redhat.com>
Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-09-10 11:23:45 +03:00
Jason Dillaman
7025fe8976 librbd: potential seg fault when blacklisting an image client
Fixes: http://tracker.ceph.com/issues/17251
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-09-09 08:31:52 -04:00
Jason Dillaman
4ce6638456 librbd: ignore cache busy errors when shrinking an image
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-09-09 08:22:47 -04:00
Jason Dillaman
3f93a19174 librbd: invalidate cache before trimming image
Any potential writeback outside the extents of a shrunk image
would result in orphaned objects.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-09-09 08:22:47 -04:00
Sage Weil
fba798dcad remove autotools
Signed-off-by: Sage Weil <sage@redhat.com>
2016-09-07 11:50:14 -04:00
Jason Dillaman
c2a5e70338 Merge pull request #10378 from trociny/wip-14738
librbd: optionally unregister "laggy" journal clients

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-09-06 22:50:15 -04:00
Mykola Golub
9a95536429 Merge pull request #10974 from dillaman/wip-17210
librbd: potential double-unwatch of watch handle upon error

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-09-06 15:38:43 +03:00
Mykola Golub
77fd6a1c20 rbd-mirror: option to automatically resync after journal client disconnect
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-09-05 12:48:47 +03:00
Mykola Golub
b8eafefba9 librbd: optionally flag "laggy" journal clients disconnected
Fixes: http://tracker.ceph.com/issues/14738
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-09-05 08:51:54 +03:00
Jason Dillaman
fdd236476c Merge pull request #9592 from trociny/wip-15632
librbd: API methods to directly acquire and release the exclusive lock

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-09-04 21:54:36 -04:00
Jason Dillaman
1068ded0cb librbd: potential double-unwatch of watch handle upon error
Fixes: http://tracker.ceph.com/issues/17210
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-09-04 21:52:38 -04:00
Mykola Golub
249f9e067c Merge pull request #10945 from dillaman/wip-17188
librbd: deadlock when replaying journal during image open

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-09-02 22:00:41 +03:00
Kefu Chai
a80af03fbf Merge pull request #10517 from wjwithagen/wip-wjw-freebsd-cmake-execludes
cmake: FreeBSD specific excludes in CMakeLists.txt files

Reviewed-by: Kefu Chai <kchai@redhat.com>
2016-09-02 01:38:44 +08:00
Jason Dillaman
3dc13067f5 librbd: deadlock when replaying journal during image open
Fixes: http://tracker.ceph.com/issues/17188
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-31 21:33:54 -04:00
Jason Dillaman
c71182a731 librbd: improve image state machine debug log messages
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-31 20:56:54 -04:00
Kefu Chai
0a717593c0 cmake: let librados_api_obj depend on librados-tp
so we don't need to messing up with the target names.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-08-30 15:51:51 +08:00
Mykola Golub
d16c046b4f Merge pull request #9121 from dillaman/wip-15688
librbd: initial hooks for client-side, image-extent cache in IO path

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-08-29 21:31:00 +03:00
Willem Jan Withagen
c5abbcb0f0 src/librbd/CMakeLists.txt: krbd and secret.c are LINUX dependant
Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
2016-08-29 16:18:29 +02:00
Kefu Chai
5e03ff0981 cmake: fix the tracing header dependencies
in aa679df, we move librados.cc into a separated obj target. this broken
the dependency from librados.o to its tracing header. we need to update
it accordingly.

this change fixes the following compilation error:
```
/var/ceph/ceph/src/librados/librados.cc:47:30: fatal error:
tracing/librados.h: No such file or directory
 #include "tracing/librados.h"
                              ^
compilation terminated.
```

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-08-29 15:06:44 +08:00
Jason Dillaman
8e69b2efc4 librbd: integrate image cache hooks into IO path
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-27 19:37:37 -04:00
Jason Dillaman
6beb353c1a librbd: C_ImageCacheRead bridge from Context to AioCompletion
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-27 19:37:37 -04:00
Jason Dillaman
bc0921870b librbd: differentiate between image and object cache
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-27 19:37:37 -04:00
Jason Dillaman
d9eb3720b9 librbd: consolidate IO clipping to reusable method
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-27 19:37:37 -04:00
Jason Dillaman
991c77d042 librbd: initial integration of ImageWriteback to AioImageRequest
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-27 19:37:37 -04:00
Jason Dillaman
633f0ab0c4 librbd: add internal support for scatter/gather IO
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-27 19:37:37 -04:00
Jason Dillaman
9176900300 librbd: support bufferlist payload for AioImageWrite
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-27 19:37:37 -04:00
Jason Dillaman
551d7eae12 librbd: remove use of owner_lock on IO path
IO is fully flushed before releasing the exclusive lock so holding
the owner_lock isn't required.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-27 19:37:37 -04:00
Jason Dillaman
9395525058 librbd: blocking parent IO completion no longer required
The completion will directly invoke the callback with the
result code.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-27 19:37:37 -04:00
Jason Dillaman
dbc498f210 librbd: skeleton implementation of client-side image cache
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-27 19:37:37 -04:00
Mykola Golub
8f1b47fd5d librbd: API methods to directly acquire and release the exclusive lock
Fixes: http://tracker.ceph.com/issues/15632
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-08-26 15:22:05 +03:00
Jason Dillaman
5156b438d5 librbd: remove unused refresh request logic
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-23 12:23:07 -04:00
Jason Dillaman
583ac91872 librbd: interlock image refresh and lock operations
Fixes: http://tracker.ceph.com/issues/16773
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-23 12:23:07 -04:00
Jason Dillaman
a5b8c9c1d8 librbd: image state machine now has hooks for lock requests
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-23 12:23:07 -04:00
Jason Dillaman
d0d97fcca2 librbd: integrate asynchronous image rewatch state machine
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-23 12:23:07 -04:00
Jason Dillaman
32180aaf42 librbd: helper state machine for asynchronous watch recovery
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-23 12:23:07 -04:00
Jason Dillaman
66c605573f librbd: exclusive lock now supports reacquiring a lost lock
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-23 12:23:07 -04:00
Jason Dillaman
aa53f74ad2 librbd: store exclusive lock cookie instead of recalculating
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-23 12:23:07 -04:00
Jason Dillaman
d523df8daf librbd: helper state machine to update lock cookie
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-23 12:23:07 -04:00
Mykola Golub
549812338e Merge pull request #10762 from dillaman/wip-16654
librbd: cache was not switching to writeback after first flush

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-08-19 16:01:45 +03:00
Ilya Dryomov
0c9ada8ec6 Merge pull request #10481 from dillaman/wip-16171
librbd: request exclusive lock if current owner cannot execute op

Reviewed-off-by: Ilya Dryomov <idryomov@gmail.com>
2016-08-17 21:03:45 +02:00
Jason Dillaman
2d9840af39 librbd: cache was not switching to writeback after first flush
Fixes: http://tracker.ceph.com/issues/16654
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-17 12:08:37 -04:00
Jason Dillaman
ac590e85a4 librbd: normalize journal promotion/demotion events
A non-primary image's commit possition won't accurately reflect
the current demotion/promotion chain. Therefore, directly specify
the predecessor for promotion events.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-16 09:11:07 -04:00
Jason Dillaman
8b195e1fc8 librbd: block RPC requests when demoting the image
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-16 09:11:07 -04:00
Jason Dillaman
718befdae7 librbd: separate journal::TagData predecessor data into new struct
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-16 09:11:06 -04:00
Jason Dillaman
47d1e62500 rbd-mirror: include tag tid in bootstrap debug log messages
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-16 09:09:52 -04:00
Ilya Dryomov
c05ee0de78 Merge pull request #10735 from dillaman/wip-17030
librbd: always respond to "release lock" request if lock owner

Reviewed-off-by: Ilya Dryomov <idryomov@gmail.com>
2016-08-16 14:58:56 +02:00
Mykola Golub
0a9ccf2b96 Merge pull request #10712 from dillaman/wip-16740
librbd: permit disabling journaling if in corrupt state

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-08-16 15:54:40 +03:00
Jason Dillaman
d8e7946fff librbd: always respond to "release lock" request if lock owner
Fixes: http://tracker.ceph.com/issues/17030
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-15 17:37:30 -04:00
Jason Dillaman
1ef143d440 librbd: fix possible memory leak when image open fails
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-15 07:48:01 -04:00
Jason Dillaman
6afb884d75 librbd: permit disabling journaling if in corrupt state
Fixes: http://tracker.ceph.com/issues/16740
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-12 14:39:43 -04:00
Jason Dillaman
73e4c65c80 librbd: new journal policy to disable initializing the journal
This will be used in the case where the journal is being disabled.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-12 14:39:43 -04:00
Jason Dillaman
7cfedb54ea librbd: fix possible inconsistent state when disabling mirroring
Fixes: http://tracker.ceph.com/issues/16984
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-12 09:52:21 -04:00
Jason Dillaman
74ec7c91f1 rbd-mirror: potential race condition during failure shutdown
Fixes: http://tracker.ceph.com/issues/16980
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-10 14:19:10 -04:00
Jason Dillaman
02d91db7b6 Merge pull request #9585 from vshankar/wip-15321
librbd: asynchronous v2 image creation

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-08-10 09:56:02 -04:00
Jason Dillaman
a10dddc439 Merge pull request #10034 from VictorDenisov/consistency_groups_images
librbd: add consistency groups operations with images

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-08-10 09:54:59 -04:00
Venky Shankar
3492153d36 journaler: remove ununsed synchronous API routines
Synchronous callers now call the asynchronous version wrapped
around C_SaferCond. Also take care of mocked methods.

Fixes: http://tracker.ceph.com/issues/15321
Signed-off-by: Venky Shankar <vshankar@redhat.com>
2016-08-07 18:54:00 +05:30
Venky Shankar
76e2d867ef rbd-mirror: asynchronously create mirror images
Use the newly instroduced asynchronous image creation state
machine (CreateRequest) to create mirrored images.

Signed-off-by: Venky Shankar <vshankar@redhat.com>
2016-08-07 18:53:59 +05:30
Venky Shankar
830e0f1f4a librbd: minor refactor in create_v1()
create_v2() uses util::generate_image_id() therefore not
requiring 'bid' to be passed in as parameter. This makes
bid generation in create() unnecessary -- hence move this
call to create_v1().

Signed-off-by: Venky Shankar <vshankar@redhat.com>
2016-08-07 18:53:59 +05:30
Venky Shankar
d2baf76d67 cls / librbd: use asynchronous image creation state machine
... plus changes in rbd class library to use helpers methods.

Signed-off-by: Venky Shankar <vshankar@redhat.com>
2016-08-07 18:53:59 +05:30
Venky Shankar
1c82132321 librbd: helper to generate unique image id
Signed-off-by: Venky Shankar <vshankar@redhat.com>
2016-08-07 18:53:59 +05:30
Venky Shankar
65d44d57dd librbd: asynchronous image creation state machine
Signed-off-by: Venky Shankar <vshankar@redhat.com>
2016-08-07 16:31:37 +05:30
Venky Shankar
d5fa466d0a librbd / journal: async journal creation state machine
Signed-off-by: Venky Shankar <vshankar@redhat.com>
2016-08-07 16:31:37 +05:30
Venky Shankar
c4e439dcdd librbd / journal: async journal removal state machine
Signed-off-by: Venky Shankar <vshankar@redhat.com>
2016-08-07 16:31:37 +05:30
Venky Shankar
1416f1c3bc librbd / ImageCtx: singleton safetimer instance helper
Signed-off-by: Venky Shankar <vshankar@redhat.com>
2016-08-07 16:31:36 +05:30
Venky Shankar
21e6573d49 librbd / ImageCtx: singleton thread pool instance helper
Introduce static member function in ImageCtx to fetch (and
initialize) singleton thread pool.

Signed-off-by: Venky Shankar <vshankar@redhat.com>
2016-08-07 16:31:36 +05:30
Mykola Golub
89a37496e7 Merge pull request #10574 from dillaman/wip-16923
librbd: delay acquiring lock if image watch has failed

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-08-07 13:33:45 +03:00
Victor Denisov
1b826e132c librbd: Implement consistency group images operations
Signed-off-by: Victor Denisov <denisovenator@gmail.com>
2016-08-05 19:09:28 -07:00
Jason Dillaman
4de7c8d0a7 librbd: prevent creation of v2 image ids that are too large
The librbd API is capped at 24 characters for expressing the
object prefix for data blocks (including trailing null byte).

Fixes: http://tracker.ceph.com/issues/16887
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-04 20:56:36 -04:00
Jason Dillaman
dfe9f3eac9 librbd: delay acquiring exclusive lock if watch has failed
Fixes: http://tracker.ceph.com/issues/16923
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-04 14:05:19 -04:00
Jason Dillaman
814c305ce8 librbd: convert ImageWatcher class to template
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-04 13:49:19 -04:00
Mykola Golub
57b69b9200 Merge pull request #10462 from dillaman/wip-16478
rbd-mirror: non-primary image is recording journal events during image sync

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-08-02 20:48:07 +03:00
Mykola Golub
42905a6d3b Merge pull request #10484 from dillaman/wip-16538
rbd-mirror: image deleter should use pool id + global image uuid for key

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-08-02 20:14:54 +03:00
Jason Dillaman
2e5076eb19 librbd: utilize factory methods to create AioObjectRequest objects
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-02 09:56:21 -04:00
Jason Dillaman
840a473e7f librbd: convert AioObjectRequest/AioObjectRead classes to templates
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-02 09:56:21 -04:00
Jason Dillaman
65b336f685 librbd: move read callback helpers to narrowest scope
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-02 09:56:21 -04:00
Jason Dillaman
a945c2c235 librbd: convert AioImageRequest derived classes to templates
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-02 09:56:21 -04:00
Jason Dillaman
f1e391982b librbd: removed namespace indentation from legacy classes
Better follows the Ceph C++ style guide

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-02 09:56:21 -04:00
Jason Dillaman
405142c615 librbd: do not record journal events if append is disabled by policy
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-02 09:56:21 -04:00
Jason Dillaman
f453554edc librbd: remove unused journal replay canceled callback
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-02 09:56:21 -04:00
Jason Dillaman
f7eeacd02f librbd: optionally support disabling journal appends via policy
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-08-02 09:56:21 -04:00
Mykola Golub
77ec14a95b Merge pull request #10432 from dillaman/wip-16708
rbd-mirror: potential IO stall when using asok flush request

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-07-30 19:59:49 +03:00
Mykola Golub
df2aa585c4 Merge pull request #10341 from dillaman/wip-16223
rbd-mirror: reduce memory footprint during journal replay

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-07-30 19:28:02 +03:00
Kefu Chai
00b6fe11d2 Merge pull request #10489 from ceph/wip-cmake
cmake changes

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
Reviewed-by: Ali Maredia <amaredia@redhat.com>
2016-07-30 13:24:32 +08:00
Kefu Chai
417c54f1ef cmake: exclude private symbols in librbd
missed it in 0edfad0.
* librbd: pass '--exclude-libs,ALL' to linker
* rbd: link against used libraries explicitly, rbd is accessing some
  internal symbols not exposed by librbd.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-07-29 23:12:33 +08:00
Mykola Golub
1d4384c54e Merge pull request #10332 from dillaman/wip-16689
librbd: optimize away unnecessary object map updates

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-07-29 16:31:04 +03:00
Jason Dillaman
87b32d1591 librbd: support deleting image by id instead of name
The rbd-mirror daemon will use this API to delete images instead
of attempting to use the local image name.

Fixes: http://tracker.ceph.com/issues/16227
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-07-28 16:36:59 -04:00
Jason Dillaman
d2d2d90d64 librbd: request exclusive lock if current owner cannot execute op
The initial krbd implementation will not support executing maintenance
ops and instead will return -EOPNOTSUPP. In this case, librbd can take
the lock and execute the operation.

Fixes: http://tracker.ceph.com/issues/16171
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-07-28 15:09:53 -04:00
Mykola Golub
dc41731fbf librbd: discard hangs when 'rbd_skip_partial_discard' is enabled
Fixes: http://tracker.ceph.com/issues/16386
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-07-28 09:28:33 +03:00
Jason Dillaman
bdeef717dc Merge pull request #9334 from yangdongsheng/rbd_clone_hiberit
rbd: inherit the parent image features when cloning an image

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-07-27 08:23:09 -04:00
Jason Dillaman
8db3083b92 Merge pull request #10087 from yangdongsheng/rbd_snap_remove_force
rbd: Allow user to remove snapshot with --force to auto flatten children

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-07-27 08:21:59 -04:00
Kefu Chai
4e8e68aa48 Merge pull request #9371 from ukernel/wip-osx-fuse
build ceph-fuse on OSX

Reviewed-by: Kefu Chai <kchai@redhat.com>
2016-07-27 20:19:04 +08:00
Dongsheng Yang
95240f2c77 rbd: introduce no-progress for rbd snap remove.
Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
2016-07-26 07:37:15 -04:00
Dongsheng Yang
9cf4878c34 librbd: fix a incorrect input for cpp_strerror()
Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
2016-07-26 02:23:30 -04:00
Dongsheng Yang
bb55b3b584 librbd: coding style: fix the indent problem
Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
2016-07-26 02:23:30 -04:00
Dongsheng Yang
95502ecefe librbd: coding style: add space after comma
Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
2016-07-26 02:23:30 -04:00
Dongsheng Yang
fe1d4c44a3 librbd: introduce a new flag of RBD_SNAP_REMOVE_FLATTEN
introduce RBD_SNAP_REMOVE_FLATTEN for flags of Image::snap_remove2()
to auto flatten the children of snapshot which we want to remove.

Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
2016-07-26 02:23:30 -04:00
Dongsheng Yang
a3a547fc03 librbd: introduce a new api of snap_remove2
currently, we only have one api for snap_remove, but if we want to
pass more options about snapshot removal, that's impossible.

This patch introduce a new api of snap_remove2 here to solve
this problem.

Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
2016-07-26 02:23:30 -04:00
Jason Dillaman
6064f2346d librbd: ensure that AIO ops are started prior to request
Fixes: http://tracker.ceph.com/issues/16708
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-07-25 12:44:50 -04:00
Jason Dillaman
3df7213c0a librbd: helper method for creating and starting AioCompletions
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-07-25 12:42:26 -04:00
Jason Dillaman
b0029b3d3d Merge pull request #9724 from vumrao/wip-vumrao-16130
rbd: cleanup - Proxied operations shouldn't result in error messages if replayed

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-07-24 11:13:44 -04:00
Jason Dillaman
ab5ebdef32 Merge pull request #10123 from trociny/wip-16449
librbd: prevent creation of clone from non-primary mirrored image

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-07-24 11:12:57 -04:00
Dongsheng Yang
cfae775889 librbd: check the RBD_FEATURE_LAYERING for the features of child image.
Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
2016-07-22 07:04:10 -04:00
Dongsheng Yang
df81ba1c7f librbd: set RBD_FEATURE_STRIPINGV2 in create if needed.
Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
2016-07-22 07:04:09 -04:00
Dongsheng Yang
22f77dd301 librbd: introduce RBD_IMAGE_OPTION_FEATURES_[SET|CLEAR] for features overwriting.
Currently, if we want to use the default options for rbd, we need to omit the
RBD_IMAGE_OPTION_FEATURES, but if we want --image-shared. we need to overwrite
something bese on the default value of image options.

This patch introduce two flags in image_options, RBD_IMAGE_OPTION_FEATURES_SET
means, we want to set something after you get the features from default, parent
or user. And RBD_IMAGE_OPTION_FEATURES_CLEAR will do a bit clear.

Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
2016-07-22 07:04:09 -04:00
Dongsheng Yang
dd299e0fca librbd/copy: set RBD_FEATURE_STRIPINGV2 in feature if stripe related options specified
Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
2016-07-22 07:04:08 -04:00
Dongsheng Yang
d97fe01cb1 librbd/clone: set RBD_FEATURE_STRIPINGV2 in feature if stripe related options specified
Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
2016-07-22 07:04:08 -04:00
Dongsheng Yang
6f5571f74a librbd: set the default options when they are not specified.
Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
2016-07-22 07:04:08 -04:00
Jason Dillaman
11d7500b9b librbd: new configuration option to restrict journal payload size
Ensure that, by default, IO journal events are broken up into manageable
sizes when factoring in that an rbd-mirror daemon might be replaying
events from thousands of images.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-07-21 12:52:57 -04:00
Jason Dillaman
47e0fbf231 librbd: wait for journal commit op event to be safely recorded
Operation request op finish events should not be fire and forget.
Instead, ensure the event is committed to the journal before
completing the op. This will avoid several possible split-brain
events during mirroring.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-07-21 12:52:57 -04:00
Jason Dillaman
dad8328f2d journal: helper class for organizing optional settings
Additional runtime configuration settings will be needed. The
new class will avoid the need to expand the constructor.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-07-21 12:52:57 -04:00
Jason Dillaman
270cb74bc2 librbd: improve journaling debug log messages
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-07-19 09:28:00 -04:00
Jason Dillaman
57cd75e805 librbd: separate journal event decoding and processing
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-07-19 09:28:00 -04:00
Jason Dillaman
f70b90c48d librbd: record original snap name in snap rename journal event
Remote peers need a key to map snapshot ids between clusters.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-07-19 09:28:00 -04:00
Jason Dillaman
77699bfe74 librbd: simple duplicate op checks for all maintenance operations
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-07-19 09:28:00 -04:00
Jason Dillaman
e5b4188635 librbd: optimize away unnecessary object map updates
Fixes: http://tracker.ceph.com/issues/16689
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-07-19 07:22:35 -04:00
Jason Dillaman
a3438bac71 Merge pull request #9291 from trociny/wip-15715
rbd-nbd does not properly handle resize notifications

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-07-18 16:44:58 -04:00
Yan, Zheng
7e319f1493 encoding: don't encode/decode 'size_t'
encode/decode funtions for type 'size_t' on OSX are ambiguous

Signed-off-by: Yan, Zheng <zyan@redhat.com>
2016-07-18 11:08:48 +08:00
Mykola Golub
ba849e3b04 librbd: prevent creation of clone from non-primary mirrored image
Fixes: http://tracker.ceph.com/issues/16449
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-07-14 23:02:18 +03:00
Vaibhav Bhembre
d1f2c557b2 rbd: add rbd_resize2 for allow_shrink option 2016-07-13 15:50:04 -04:00
Mykola Golub
9952b75a0c librbd: API: methods to watch image stat update
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-07-13 15:40:02 +03:00
Vikhyat Umrao
d09c9c471f rbd: cleanup - Proxied operations shouldn't result
in error messages if replayed

Fixes: http://tracker.ceph.com/issues/16130

Signed-off-by: Vikhyat Umrao <vumrao@redhat.com>
2016-07-07 12:45:15 +05:30
Jason Dillaman
b342bf8ea1 Merge pull request #10136 from runsisi/sisi-wip-fix-missing-return
librbd: fix missing return statement if failed to get mirror image state

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-07-05 21:44:32 -04:00
runsisi
ea775178b6 librbd: fix missing return statement if failed to get mirror image state
Signed-off-by: runsisi <runsisi@zte.com.cn>
2016-07-05 16:08:40 +08:00
Jason Dillaman
34d2297eed librbd: failed assertion after shrinking a clone image twice
Fixes: http://tracker.ceph.com/issues/16561
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-06-30 15:00:32 -04:00
Mykola Golub
4f6d153c13 Merge pull request #9923 from dillaman/wip-16471
librbd: removal of partially deleted image needs id lookup

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-06-28 16:01:39 +03:00
Jason Dillaman
2066ad818f Merge pull request #9539 from cxwshawn/wip-tc9-fix
librbd: optimize header file dependency and modify related files

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-06-28 08:20:10 -04:00
Jason Dillaman
921e03cf41 Merge pull request #9500 from zhuangzeqiang/wip-16056
librbd: restrict mirror enable/disable actions on parents/clones

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-06-28 08:19:28 -04:00
Jason Dillaman
89eb5635b5 Merge pull request #9856 from hzhang-wx/master
librbd: discard should return error if length too large

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-06-28 08:18:14 -04:00
Jason Dillaman
6a9e7da6c3 librbd: removal of partially deleted image needs id lookup
Several operations depend on the image id but if the image cannot be
opened to retrieve the id, these cleanup operations cannot be executed.

Fixes: http://tracker.ceph.com/issues/16471
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-06-27 14:01:45 -04:00
Mykola Golub
e92b3950cd librbd: potential use after free on refresh error
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-06-27 14:45:02 +03:00
Huan Zhang
ec259dfde8 rbd discard return -EINVAL if len > MAX_INT32
rbd discard use 'int' to return discarded length, but the 'len' user
passed is 'uint64', in some case, the ret value will be truncated
and return a negative value which means discard failed. ret -EINVAL
if len > MAX_INT32 to indicate support len <= MAX_INT32 only.

Fixes: http://tracker.ceph.com/issues/16465
Signed-off-by: Huan Zhang <zhanghuan@chinac.com>
2016-06-27 16:52:49 +08:00
Mykola Golub
63b82de32f Merge pull request #9922 from dillaman/wip-16470
librbd: do not propagate mirror status notification failures

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-06-25 20:00:30 +03:00
zhuangzeqiang
11dee0bbf0 rbd: restrict mirror enable/disable actions on parents/clones
Fixes: http://tracker.ceph.com/issues/16056

Signed-off-by: zhuangzeqiang zhuang.zeqiang@h3c.com
2016-06-25 10:21:30 +08:00
Mykola Golub
3f60a67524 Merge pull request #9905 from dillaman/wip-16450
librbd: mark exclusive lock as released after journal is closed

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-06-24 22:21:52 +03:00
Mykola Golub
828710ef39 Merge pull request #9899 from dillaman/wip-16350
librbd: ignore missing object map during snap remove

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-06-24 22:21:11 +03:00
Mykola Golub
b1576c5519 Merge pull request #9896 from dillaman/wip-16446
librbd: delete ExclusiveLock instance when switching to snapshot

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-06-24 22:20:24 +03:00
Mykola Golub
cfaff361e8 Merge pull request #9895 from dillaman/wip-16445
librbd: ignore snap unprotect -EBUSY errors during journal replay

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-06-24 22:19:19 +03:00
Jason Dillaman
97bade9f76 librbd: do not propagate mirror status notification failures
These should be treated as a broadcast since no ACK is required. The
peer will eventually see the notification or its watch will have timed
out and it will re-sync.

Fixes: http://tracker.ceph.com/issues/16470
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-06-24 10:03:53 -04:00
Jason Dillaman
f506975084 librbd: memory leak possible if journal op event failed
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-06-24 08:21:37 -04:00
Yuan Zhou
8d80c05029 librbd: trivial fix to remove unused code block
Signed-off-by: Yuan Zhou <yuan.zhou@intel.com>
2016-06-24 15:44:28 +08:00
Jason Dillaman
1811e62aa0 librbd: mark exclusive lock as released after journal is closed
Fixes: http://tracker.ceph.com/issues/16450
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-06-23 13:34:56 -04:00
Mykola Golub
463a78cdd5 Merge pull request #9882 from dillaman/wip-16364
librbd: fix crash while using advisory locks with R/O image

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-06-23 20:26:11 +03:00
Mykola Golub
c763018adf Merge pull request #9881 from dillaman/wip-16433
librbd: journal::Replay no longer holds lock while completing callback

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-06-23 20:25:38 +03:00
Mykola Golub
bfe8421036 Merge pull request #9867 from dillaman/wip-16411
rbd-mirror: disallow proxied maintenance ops to non-primary images

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-06-23 20:25:03 +03:00
Jason Dillaman
68b296b0f1 librbd: ignore missing object map during snap remove
Fixes: http://tracker.ceph.com/issues/16350
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-06-23 10:25:54 -04:00
Jason Dillaman
677832ceb2 librbd: delete ExclusiveLock instance when switching to snapshot
Fixes: http://tracker.ceph.com/issues/16446
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-06-23 09:23:32 -04:00
Jason Dillaman
beef0b4b02 librbd: ignore snap unprotect -EBUSY errors during journal replay
Fixes: http://tracker.ceph.com/issues/16445
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-06-23 08:50:38 -04:00
Kefu Chai
5ccdb517d6 cmake: move rados_snap_set_diff_obj into librbd_internal
ceph_test_librbd use it and links directly against librbd_internal
instead of against librbd

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-06-23 10:42:26 +08:00
Jason Dillaman
1007aea3d7 librbd: fix crash while using advisory locks with R/O image
Fixes: http://tracker.ceph.com/issues/16364
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-06-22 18:19:52 -04:00
Jason Dillaman
3112a93b49 librbd: journal::Replay no longer holds lock while completing callback
Fixes: http://tracker.ceph.com/issues/16433
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-06-22 18:09:29 -04:00
Jason Dillaman
48d18030fd Merge pull request #9207 from rjfd/wip-15670
rbd-mirror: image resync

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-06-22 18:03:22 -04:00
Jason Dillaman
070bb07874 Merge pull request #9451 from s09816/master
librbd: enable/disable of features is not allowed when already enabled/disabled

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-06-22 14:02:42 -04:00
Jason Dillaman
2b7f28c234 Merge pull request #9715 from trociny/wip-16321
librbd: re-register watch on old format image rename

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2016-06-22 14:02:01 -04:00
Mykola Golub
74c5da8b24 Merge pull request #9850 from dillaman/wip-16404
librbd: flag image as updated after proxying maintenance op

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-06-22 20:12:59 +03:00
Jason Dillaman
93e2faf38e librbd: optionally block proxied requests with an error code
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-06-22 10:13:45 -04:00
shawn
2185a6275c librbd: optimize header file dependency & modify related file.
Signed-off-by: Xiaowei Chen <chen.xiaowei@h3c.com>
2016-06-22 02:12:12 -04:00
shawn
88afa40868 librbd: optimize operation header file dependency
Signed-off-by: Xiaowei Chen <chen.xiaowei@h3c.com>
2016-06-22 02:02:13 -04:00
Kefu Chai
0d727dbf7b cmake: install dso into ${CMAKE_INSTALL_LIBDIR} instead of "lib"
Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-06-22 11:30:46 +08:00
Kefu Chai
c7f8b8558f cmake: add visibility flags for exported dso
* no regression found, and there's a substantial reduction in the size of
  generated librados library (both stripped and not).
* also remove the duplicated set_target_properties(librbd...) command

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-06-22 11:30:46 +08:00
Kefu Chai
c1e8b028cc cmake: move snap_set_diff.cc out of librados
snap_set_diff.cc is used internally and is not exposed via librados. we
cannot use the function implemented in it by linking against librados. so
compile it as an OBJECT target and link against it individualy if
necessary.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-06-22 11:30:46 +08:00
Jason Dillaman
478dd5f173 librbd: flag image as updated after proxying maintenance op
Fixes: http://tracker.ceph.com/issues/16404
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-06-21 14:56:43 -04:00
Mykola Golub
d404e36a9e Merge pull request #9819 from dillaman/wip-16363
librbd: fix lockdep issue when duplicate event detected

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-06-21 19:50:28 +03:00
Mykola Golub
1169da520e Merge pull request #9816 from dillaman/wip-16198
librbd: potential race when replaying journal ops

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
2016-06-21 19:49:37 +03:00
shawn
59397e27a0 librbd: optimize journal header file dependency
Signed-off-by: Xiaowei Chen <chen.xiaowei@h3c.com>
2016-06-20 23:03:03 -04:00
shawn
aee1559f31 librbd: optimize image_watcher header file dependency
Signed-off-by: Xiaowei Chen <chen.xiaowei@h3c.com>
2016-06-20 23:03:03 -04:00
shawn
461958ebc7 librbd: optimize image header file dependency
Signed-off-by: Xiaowei Chen <chen.xiaowei@h3c.com>
2016-06-20 23:02:55 -04:00
shawn
01282eb5cd librbd: optimize exclusive_lock header file dependency
Signed-off-by: Xiaowei Chen <chen.xiaowei@h3c.com>
2016-06-20 22:58:18 -04:00
shawn
1a2276927d librbd: optimize object-map header file dependency
Signed-off-by: Xiaowei Chen <chen.xiaowei@h3c.com>
2016-06-20 22:58:12 -04:00
Jason Dillaman
86ef725c34 librbd: fix lockdep issue when duplicate event detected
Fixes: http://tracker.ceph.com/issues/16363
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-06-20 10:32:04 -04:00