Clean up defer_recovery() functions

Signed-off-by: David Zafman <david.zafman@inktank.com>
OSD,PG: lock_with_map_lock_held() is the same as lock()

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG: reassert_lock_with_map_lock_held() is dead

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG: rename must_delay_request to op_must_wait_for_map, make static

Signed-off-by: Samuel Just <sam.just@inktank.com>
AsyncReserver: Remove assert in set_max() for max > 0

Signed-off-by: David Zafman <david.zafman@inktank.com>
Add priority option to AsyncReserver class

Add priority to request_reservation()
Change to map of lists by prioriry
Add priority to queue_pointers mappped type

Signed-off-by: David Zafman <david.zafman@inktank.com>
osd: prioritize recovery for degraded pgs

Three Reservation priorities from RECOVERY, BACKFILL_HIGH, BACKFILL_LOW

fixes: #4273

Signed-off-by: David Zafman <david.zafman@inktank.com>
PG,OSD: delay ops for map prior to queueing in the OpWQ

Previously, we simply queued ops in the OpWQ without checking.  The PG
would then check in do_request whether the message should wait for a new
map.  Unfortunately, this has the side effect that any op requeued for
any reason must also requeue the waiting_for_map queue.

Now, we will check before queueing the op whether it must wait on a map.
To avoid contention, there is now a map_lock which must be held along
with the PG lock in order to update the osdmap_ref.  The map_lock also
protects the waiting_for_map list and queueing PG ops at the back of
the OpWQ.  A few details:
1) It is no longer necessary to requeue waiting_for_map in on_change()
since the other ops are queued at the front.
2) Once waiting_for_map is non-empty, all ops are delayed to simplify
ordering.
3) waiting_for_map may now be non-empty during split, so we must split
waiting_for_map along with waiting_for_active.  This must be done
under the map_lock.

The bug which uncovered this involved an out of order op as follows:

client.4208.0:2378 (e252) arrives, object is degraded
client.4208.0:2379 (e253) arrives, waits for map
client.4208.0:2378 (e252) is requeued after recovery
client.4208.0:2379 (e253) is requeued on map arrival
client.4208.0:2379 is processed
client.4208.0:2378 is processed

Fixes: #4955
Signed-off-by: Samuel Just <sam.just@inktank.com>
Merge branch 'wip_4955' into next

Reviewed-by: Sage Weil <sage@inktank.com>
Throttle: add a simpler throttle that just blocks above a threshold

This is convenient to use to turn synchronous calls into asynchronous
calls with a limited number of operations in flight concurrently.
It assumes the caller will wait for all operations to complete at the
end.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
librbd: delete more than one object at once

Speed up deletions when resizing down or removing an image by keeping
up 10 operations in flight by default.

Refs: #2256
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
librados: add selfmanaged_snap_rollback as an ObjectOperation

This allows it to be done asynchronously, or in conjunction with
other operations.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
doc: fix broken link to ceph-deploy in release notes

Signed-off-by: Ross Turk <ross@inktank.com>
mds: be more explicit about path_traverse completion

Coverity turned up

CID 717085 (#1 of 1): Resource leak (RESOURCE_LEAK)
10. leaked_storage: Variable "c" going out of scope leaks the storage it points to.

from _find_ino_dir(), but for all r > 0 cases fin is consumed.  Make this
a bit more explicit by using the helper in the mdr-only case, and by
asserting it is zero in the return 2 path.  Hopefully coverity will notice.

Signed-off-by: Sage Weil <sage@inktank.com>
doc: Fixed typos. Somehow got a merge error.

Signed-off-by: John Wilkins <john.wilkins@inktank.com>
ObjectStore.cc: add missing break in switch

Fix switch handling for case OP_SPLIT_COLLECTION2, add break after
the case to prevent fall through into default case.

CID 1019562 Missing break in switch (CWE-484)

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
client/SyntheticClient.cc: add missing break in switch

Fix switch handling for case SYNCLIENT_MODE_OVERLOAD_OSD_0, add break
after the case to prevent fall through into next case.

CID 716958 Missing break in switch (CWE-484)

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
rgw/rgw_user.cc: add missing break in switch

Fix switch handling for case KEY_TYPE_SWIFT, add break after the
case to prevent fall through into KEY_TYPE_S3 case.

CID 1019563 Missing break in switch (CWE-484)

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
libcephfs/test.cc: add assert for result of ceph_getxattr()

Check result of ceph_getxattr() before pass it as parameter to
strncmp(). Make sure it's not negative.

CID 739411 Argument cannot be negative (CWE-687)

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
test/omap_bench.cc: remove dead code

CID 716900 Logically dead code (CWE-561)
CID 716901 Logically dead code (CWE-561)
CID 727968 Logically dead code (CWE-561)

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>