PG: use remove_object_with_snap_hardlinks for divergent objects

Otherwise, we end up leaving snap hardlinks in the snapshot
index directories.  This eventually results in an EEXIST error
when we attempt to re-link the clone into place during
recovery.

Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
PG::merge_old_entry: fix case for divergent prior_version

Previously, we asserted that a log entry with a divergent
prior_version must be a clone.  Consider the following
case:

6'11(6'2)  m foo
7'12(6'3) m bar
7'13(7'12) m bar

If this is merged with:

6'11(6'2)  m foo
8'12(6'4) m baz

we will hit the assert.  The correct behavior is simply to remove
the object as in the clone case.

Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
rbd: allow removal of image even if rbd_children deletion fails

Users have been seeing failures where rbd rm is half-done; could be
because of outstanding watches on the rbd_header object.  The state
is that rbd_children no longer contains the child, but other pieces
remain; remove considers this a failure.

Fix: test for ENOENT from remove_child, and treat that as an ignorable
error and drive on.  Simulate this in copy.sh by removing the
rbd_children object altogether, which also results in ENOENT return
from remove_child.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
rgw: break out of read loop if we got zero bytes

If the part that we're reading is corrupted and we end up
reading zero bytes, we need to exit, otherwise we'd just
loop forever.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: don't reset multipart parts when updating their metadata

Fixes: #3401
The problem was that put_obj_meta() was assuming object is going
to be reset, so it was resetting the object anyway. This is not
true when dealing with the immutable multipart upload parts.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: fix multipart overwrite

Fixes: #3400
Removed a few lines of code that prematurely created the head
part of the final object (before creating the manifest).

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
java: use accessors for mode flag tests

Add isDir(), isFile(), and isSymlink() for read-only tests corresponding
to the S_ISREG test and friends.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Reviewed-by: Joe Buck <jbbuck@gmail.com>
rgw: resolve hostname dns cname record

Implements #3206
This allows using vanity domains. A CNAME record can now
be set for the domain that would point at the rgw instance,
with or without a bucket set as a subdomain.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
Merge remote-tracking branch 'origin/master' into wip-3206
rgw: document cname configurable

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
cls_rbd: send proper format of key to "last_read" for dir_list

rbd ls of format-2 images was looping on the first 64 (when more than 64
were present).  The key name passed to the omap layer needs to always
contain the prefix, and the "inside-the-loop next-chunk" statement
was missing the "add the prefix" call.

Also, add a test for listing 100 images, format 1 and 2.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Merge branch 'next'
Merge git://github.com/ceph/ceph