librbd: fix crash using clone of flattened image

The crash occurs due to ImageCtx->parent->parent being uninitialized,
since the inital open_parent() -> open_image(parent) ->
ictx_refresh(parent) occurs before ImageCtx->parent->snap_id is set,
so refresh_parent() is not called to open an ImageCtx for the parent
of the parent. This leaves the ImageCtx->parent->parent NULL, but the
rest of ImageCtx->parent updated to point at the correct parent snapshot.

Setting the parent->snap_id earlier has some unintended side effects
currently, so for now just call refresh_parent() during
open_parent(). This is the easily backportable version of the
fix. Further patches can clean up this whole initialization process.

Fixes: #8845
Backport: firefly, dumpling
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
librbd: store and retrieve snapshot metadata based on id

Snapshots are usually accessed by id internally, so change accessors
to take id instead of name. Keep a separate map of name -> id for
looking up human-specified names.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
mailmap: Red Hat names normalization

Signed-off-by: Loic Dachary <loic@dachary.org>
librbd: enable rbd cache by default; writethrough until flush

This is recommended and safe.  Avoid some user confusion.

Signed-off-by: Sage Weil <sage@redhat.com>
mailmap: Ma Jianpeng affiliation

and name normalization

Reviewed-by: Ma Jianpeng <jianpeng.ma@intel.com>
Signed-off-by: Loic Dachary <loic@dachary.org>
mailmap: Kevin Cox affiliation

Reviewed-by: Kevin Cox <kevincox@kevincox.ca>
Signed-off-by: Loic Dachary <loic@dachary.org>
mailmap: Accela Zhao affiliation

Signed-off-by: Loic Dachary <loic@dachary.org>
mailmap: Adam Crume affiliation

Signed-off-by: Loic Dachary <loic@dachary.org>
mailmap: Stephen Jahl affiliation

Reviewed-by: Stephen Jahl <stephenjahl@gmail.com>
Signed-off-by: Loic Dachary <loic@dachary.org>
mailmap: George Ryall affiliation

Signed-off-by: Loic Dachary <loic@dachary.org>
mailmap: Brian Rak affiliation

and name normalization

Reviewed-by: Brian Rak <dn@devicenull.org>
Signed-off-by: Loic Dachary <loic@dachary.org>
mailmap: Sebastien Ponce name normalization

Signed-off-by: Loic Dachary <loic@dachary.org>
mailmap: João Eduardo Luís name normalization

Signed-off-by: Loic Dachary <loic@dachary.org>
mailmap: Tommi Virtanen is not with Red Hat

The entry was added by s/inktank/redhat/ and did not acknowledge that
Tommi Virtanen left Inktank before it was acquired.

Signed-off-by: Loic Dachary <loic@dachary.org>
mailmap: sort entries

to help avoid duplicates (found one)

Signed-off-by: Loic Dachary <loic@dachary.org>
osd: reorder OSDService methods under proper dout_prefix macro

The dout_prefix for OSDService uses get_osdmap() to grab a shared_ptr for
the epoch printout.  The OSD one does not, and is not safe to run in all
thread contexts.

In particular, update_osd_stat() is run by the heartbeat thread and can
race with the shared_ptr itself being updated with a new map.

Ironically, if this were simply an OSDMap*, there would be no race since
the pointer is a single word and updates atomically.

Fix this, and any similar issues, by moving the OSDService methods up in
OSD.cc so that they use the safe dout macro.

Fixes: #8998
Backport: firefly (in a minimal form, I think!)
Signed-off-by: Sage Weil <sage@redhat.com>
osd: simplify dout_prefix macros

Use a get_osdmap_epoch() helper that is a bit lighter weight (by avoiding
copying around an OSDMapRef).

Signed-off-by: Sage Weil <sage@redhat.com>
Merge pull request #2198 from ceph/wip-8998

fix OSD SEGV in heartbeat()

Reviewed-by: Samuel Just <sam.just@inktank.com>
add annotation for rocksdb config option

Signed-off-by: xinxin shu <xinxin.shu@intel.com>
osd/osd_types: add blocked_by to pg_stat_t

Signed-off-by: Sage Weil <sage@redhat.com>