crushtool: add cli test for off-by-one tries vs retries bug

See bug #7370.  This passes on dumpling and breaks prior to the #7370 fix.

Backport: emperor, dumpling
Signed-off-by: Sage Weil <sage@inktank.com>
crush: fix off-by-one errors in total_tries refactor

Back in 27f4d1f6bc32c2ed7b2c5080cbd58b14df622607 we refactored the CRUSH
code to allow adjustment of the retry counts on a per-pool basis.  That
commit had an off-by-one bug: the previous "tries" counter was a *retry*
count, not a *try* count, but the new code was passing in 1 meaning
there should be no retries.

Fix the ftotal vs tries comparison to use < instead of <= to fix the
problem.  Note that the original code used <= here, which means the
global "choose_total_tries" tunable is actually counting retries.
Compensate for that by adding 1 in crush_do_rule when we pull the tunable
into the local variable.

This was noticed looking at output from a user provided osdmap.
Unfortunately the map doesn't illustrate the change in mapping behavior
and I haven't managed to construct one yet that does.  Inspection of the
crush debug output now aligns with prior versions, though.

Signed-off-by: Sage Weil <sage@inktank.com>
crush: allow crush rules to set (re)tries counts to 0

These two fields are misnomers; they are *retry* counts.

Signed-off-by: Sage Weil <sage@inktank.com>
Merge pull request #1201 from ceph/wip-7370

crush: fix tries/retries bug that was recently introduced

Reviewed-by: Loic Dachary <loic@dachary.org>
ceph_test_rados_api_tier: try harder to trigger the flush vs try-flush race

It seems to be reasonable easy to complete a flush before the next client
request is processed.  Crazy...

Same with the flush vs write race.

Fixes: #7329
Signed-off-by: Sage Weil <sage@inktank.com>
Merge remote-tracking branch 'gh/wip-7329' into next
configure: don't check for arpa/nameser_compat.h twice

Nuke redundant check and move the real one into the common
AC_CHECK_HEADERS stanza.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
configure: fix F_SETPIPE_SZ detection

Currently CEPH_HAVE_SETPIPE_SZ is not set even if F_SETPIPE_SZ is
available, because AC_COMPILE_IFELSE test program as written always
fails to compile.  F_SETPIPE_SZ is a macro, so use AC_EGREP_CPP which
works on the preprocessor output instead of trying to compile.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
common/buffer: fix build breakage for CEPH_HAVE_SETPIPE_SZ

common/buffer.cc fails to build if CEPH_HAVE_SETPIPE_SZ is defined.
Fix it.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Merge remote-tracking branch 'gh/next'
Merge pull request #1204 from ceph/wip-fsetpipesz-fix

Reviewed-by: Josh Durgin <josh.durgin@inktank.com>