]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
osd/ReplicatedPG: adjust obc + snapset_obc locking strategy
authorSage Weil <sage@inktank.com>
Wed, 9 Apr 2014 19:38:10 +0000 (12:38 -0700)
committerSage Weil <sage@inktank.com>
Thu, 10 Apr 2014 17:55:55 +0000 (10:55 -0700)
commita8f0953974511cd2883bd5d678ff47c4574064ea
tree6f2768d29135b35560c2acb9d4083f25394bd115
parentcf69bdbd7498a151b251b20c1552003c82f26db7
osd/ReplicatedPG: adjust obc + snapset_obc locking strategy

Prevoiusly we assumed that if we had snapset_obc set, !exists on the head
and if we got the snapdir lock we were good to take the head lock too.
This is no the case when:

 - delete queued
   - takes wr lock on both head and snapdir
 - delete commits (but not yet applied)
 - stat
   - tries to take wr lock on head
     - blocks, toggles w=1 state on *head only*
 - copy-from
   - tries to take wr lock on snapdir, succeeds
   - tries to take wr lock on head, fails because w=1
     - fails the assert(got)

The problem is that the read and write paths are taking different locks
and we are expecting them to operate in synchrony.

Fix this by using the same ordering for reads as well as write: if the
snapset_obc is defined, take the read lock on that too, just as we do with
a write.

Fixes: #8046
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Samuel Just <sam.just@inktank.com>
src/osd/ReplicatedPG.h