]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: snap create doesn't properly handle race conditions
authorJason Dillaman <dillaman@redhat.com>
Wed, 25 Nov 2015 19:09:25 +0000 (14:09 -0500)
committerJason Dillaman <dillaman@redhat.com>
Wed, 2 Dec 2015 16:11:12 +0000 (11:11 -0500)
The ESTALE result code was being filtered out, preventing the retry
logic.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/operation/SnapshotCreateRequest.cc

index 545a7ba9953d8d1aeefa35261e3694a8a71c4076..37f2841422e6929577ee2fd02d596fbb33643440 100644 (file)
@@ -69,6 +69,7 @@ bool SnapshotCreateRequest<I>::should_complete(int r) {
   CephContext *cct = image_ctx.cct;
   ldout(cct, 5) << this << " " << __func__ << ": state=" << m_state << ", "
                 << "r=" << r << dendl;
+  int orig_result = r;
   r = filter_state_return_code(r);
   if (r < 0) {
     lderr(cct) << "encountered error: " << cpp_strerror(r) << dendl;
@@ -94,11 +95,11 @@ bool SnapshotCreateRequest<I>::should_complete(int r) {
     send_create_snap();
     break;
   case STATE_CREATE_SNAP:
-    if (r == 0) {
+    if (orig_result == 0) {
       update_snap_context();
       finished = send_create_object_map();
     } else {
-      assert(r == -ESTALE);
+      assert(orig_result == -ESTALE);
       send_allocate_snap_id();
     }
     break;