client: double mount returns -EISCONN

Change error code from -EDOM to -EISCONN when mounting an already
mounted ceph_mount_info instance.  The current convention is to return
-ENOTCONN when using the libcephfs interface in an unmounted state.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
client: add ceph_release, ceph_shutdown

Notes that ceph_shutdown() is now deprecated.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Merge branch 'wip-client-unmount'

Signed-off-by: Noah Watkins <noah.watkins@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
librbd: fix race in AioCompletion that are still being built

When caching is enabled, it is possible for the io completion to happen
faster than we call ->finish_adding_requests() (e.g., on cache read).
When that happens, the final read request completion doesn't see a
pending_count == 0 and thus doesn't do all the final buffer construction
that is necessary to return correct data.  In particular, users will see
zeroed buffers.  test_librbd_fsx is turning this up consistently after
several thousand ops with an image size of ~100MB and cloning disabled.

This was introduced with the extra logic added here with striping.

Fix this by making a separate flag to indicate the completion is under
construction, and make sure we call complete() when both pending_count==0
and building==false.

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
java: add FileAlreadyExists exception

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
java: add O_WRONLY open flag

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
java: remove tabs to fix formatting

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
java: log listdir contents in java client

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
java: mkdirs returns IOException

For example, CephFileAlreadyExistsException may be returned if mkdirs is
called to create a directory already present.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
java: enable ceph_unmount

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
java: enable ceph_release

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
java: clean-up in finalize()

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

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
java: add AlreadyMounted exception

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
java: add tests for double mounting

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
java: use unique directory in test

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
PG: Do not discard op data too early

Under a sustained cephfs write load where the offered load is higher
than the storage cluster write throughput, a backlog of replication ops
that arrive via the cluster messenger builds up.  The client message
policy throttler, which should be limiting the total write workload
accepted by the storage cluster, is unable to prevent it, for any
value of osd_client_message_size_cap, under such an overload condition.

The root cause is that op data is released too early, in op_applied().

If instead the op data is released at op deletion, then the limit
imposed by the client policy throttler applies over the entire
lifetime of the op, including commits of replication ops.  That
makes the policy throttler an effective means for an OSD to
protect itself from a sustained high offered load, because it can
effectively limit the total, cluster-wide resources needed to process
in-progress write ops.

Signed-off-by: Jim Schutt <jaschut@sandia.gov>
Merge branch 'wip-java-cephfs'

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Reviewed-by: Joe Buck <joe.buck@inktank.com>
doc: updated front page graphic.

fixes: #3412

Signed-off-by: John Wilkins <john.wilkins@inktank.com>
Merge branch 'master' of https://github.com/ceph/ceph