]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
osd/ReplicatedPG: fix enqueue_front race 1470/head
authorSage Weil <sage@inktank.com>
Fri, 14 Mar 2014 23:32:48 +0000 (16:32 -0700)
committerSage Weil <sage@inktank.com>
Fri, 14 Mar 2014 23:32:48 +0000 (16:32 -0700)
commit0f75c5419d61aed63b6cb785145ffd89221a6751
tree7c69ab2b2dc660dd8c982b04cc84f3fdd74108ca
parent35f1b042aa6d0a9dc3ce6b27ebd945cff8c2b532
osd/ReplicatedPG: fix enqueue_front race

When requeuing and item at the front, we need to shuffle the items in
pg_for_processing if there is an entry for this PG there.  If so, we need
to hold the qlock for the duration of the requeue of the shuffled item
back into the primary queue in order to avoid reshuffling items.  For
example, consider the queue has

 A B C D

 - dequeue1 gets (pg, A), puts A in the processing list
 - dequeue1 tries to lock pg, blocks
 - enqueue_front on X takes qlock, swaps it for A, drops qlock
 - dequeue2 gets (pg, B), puts B in the processing list
 - enqueue_front pushes X back into the original list

 so we have processing: X B  queue: A C D

 - dequeue* get X, then B, then A C D

If we whole qlock for the duration of the enqueue_front, we avoid dequeu2
from sneaking in an shuffling B into the processing list before we have
crammed A back onto the front of the list.

This may have caused #7712.

Backport: emperor, dumpling
Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/OSD.cc