Skip to content

Commit

Permalink
os/bluestore: flush before enumerating omap values
Browse files Browse the repository at this point in the history
For a few update ops we enumerate omap keys (to remove them).
Make sure we flush the pipeline before doing so or else we may
lose keys inserted by a previous transaction that hasn't yet
committed.

Fixes: http://tracker.ceph.com/issues/18140
Signed-off-by: Sage Weil <sage@redhat.com>
  • Loading branch information
liewegas committed Dec 5, 2016
1 parent 4b8b0c0 commit d550a5b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/os/bluestore/BlueStore.cc
Expand Up @@ -8256,6 +8256,7 @@ int BlueStore::_do_remove(
if (r < 0)
return r;
if (o->onode.omap_head) {
o->flush();
_do_omap_clear(txc, o->onode.omap_head);
}
o->exists = false;
Expand Down Expand Up @@ -8390,6 +8391,7 @@ int BlueStore::_omap_clear(TransContext *txc,
dout(15) << __func__ << " " << c->cid << " " << o->oid << dendl;
int r = 0;
if (o->onode.omap_head != 0) {
o->flush();
_do_omap_clear(txc, o->onode.omap_head);
o->onode.omap_head = 0;
txc->write_onode(o);
Expand Down Expand Up @@ -8494,6 +8496,7 @@ int BlueStore::_omap_rmkey_range(TransContext *txc,
if (!o->onode.omap_head) {
goto out;
}
o->flush();
it = db->get_iterator(PREFIX_OMAP);
get_omap_key(o->onode.omap_head, first, &key_first);
get_omap_key(o->onode.omap_head, last, &key_last);
Expand Down Expand Up @@ -8580,6 +8583,7 @@ int BlueStore::_clone(TransContext *txc,
// clone omap
if (newo->onode.omap_head) {
dout(20) << __func__ << " clearing old omap data" << dendl;
newo->flush();
_do_omap_clear(txc, newo->onode.omap_head);
}
if (oldo->onode.omap_head) {
Expand Down

0 comments on commit d550a5b

Please sign in to comment.