mds: fix end check in Server::handle_client_readdir()

commit 1174dd3188 (don't retry readdir request after issuing caps)
introduced an bug that wrongly marks 'end' in the the readdir reply.
The code that touches existing dentries re-uses an iterator, and the
iterator is used for checking if readdir is end.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Signed-off-by: Sage Weil <sage@inktank.com>
java: support stat()

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
java: support fchmod

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
java: add missing chmod unmounted test

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
java: fix exception name typo

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
libcephfs: document ERANGE rv for get_file_pool_name

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
java: support ceph_get_file_pool_name

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
java: remove extra whitespace

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Revert "mon: implement safety interlock for deleting pools"

This reverts commit c993ac9b1fa4037f4cc2674455728ee38a7c978b.

This is too hard to test.  Requiring the pool name twice along with
--yes-i-really-really-mean-it should be sufficient.

Signed-off-by: Sage Weil <sage@inktank.com>
mon: safety interlock for pool deletion

Require that the pool name be passed twice along with an force option
before we irreversibly delete an entire pool of objects.

Signed-off-by: Sage Weil <sage@inktank.com>
qa/workunits/rbd/copy.sh: use non-deprecated --image-format option

--format is deprecated.

Signed-off-by: Sage Weil <sage@inktank.com>
mon: Monitor: force timecheck cleanup on finish_election()

Fixes: #3854

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
mon: Elector: reset the acked leader when the election finishes and we lost

Failure to do so will mean that we will always ack the same leader during
an election started by another monitor.  This had been working so far
because we were still acking the existing leader if he was supposed to
still be the leader; or we were acking a new potentially leader; or we
would eventually fall behind on an election and start a new election
ourselves, thus resetting the previously acked leader.  While this wasn't
something that mattered much until now, the timechecks code stumbled into
this tiny issue and was failing hard at completing a round because there
wouldn't be a reset before the election started -- timechecks are bound
to election epochs.

Fixes: #3854

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
doc: fix rbd create syntax

--dest-pool does not apply to create. Also remove extraneous
whitespace.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
mon: Monitor: rework timecheck code to clarify logic boundaries

The initial timecheck implementation relied on a cleanup function to
clean the state each time we changed epochs (or we got out of quorum),
and we would have to clean up the state in-between rounds in a potentially
confusing way some time down the line.

This patch creates logic boundaries in the code flow, making it clear
where we set up or clear the state when we start or finish an epoch, and
where we set up or clear the round state in-between rounds.  It also
allowed for some other changes in behavior, such as when we set-up the
timecheck event, or when we cancel it.  Despite the slight increase in
size, the mechanism just got more easily understandable than it was before.

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
Merge branch 'wip-java-api'

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Reviewed-by: Joe Buck <jbbuck@gmail.com>
Reviewed-by: Sage Weil <sage@inktank.com>
utime: fix narrowing conversion compiler warning in sleep()

Fix compiler warning:
./include/utime.h: In member function 'void utime_t::sleep()':
./include/utime.h:139:50: warning: narrowing conversion of
 '((utime_t*)this)->utime_t::tv.utime_t::<anonymous struct>::tv_sec' from
 '__u32 {aka unsigned int}' to '__time_t {aka long int}' inside { } is
 ill-formed in C++11 [-Wnarrowing]
./include/utime.h:139:50: warning: narrowing conversion of
 '((utime_t*)this)->utime_t::tv.utime_t::<anonymous struct>::tv_nsec' from
 '__u32 {aka unsigned int}' to 'long int' inside { } is
 ill-formed in C++11 [-Wnarrowing]

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
rbd: don't ignore return value of system()

Check for the return value of system() and handle the error if needed

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
configure: fix check for fuse_getgroups()

Check for fuse_getgroups() only in case we have found libfuse already.
Moved the check to the check for --with-fuse.

Small fix: fix string for NO_ATOMIC_OPS, don't use "'".

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
rbd-fuse: fix usage of conn->want

Fix usage of conn->want and FUSE_CAP_BIG_WRITES. Both need libfuse
version >= 2.8. Encapsulate the related code line into a check for
the needed FUSE_VERSION as already done in ceph-fuse in some cases.

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