]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/ReplicatedPG: fix undirty on clean object
authorSage Weil <sage@inktank.com>
Tue, 17 Dec 2013 20:33:54 +0000 (12:33 -0800)
committerSage Weil <sage@inktank.com>
Fri, 20 Dec 2013 00:40:01 +0000 (16:40 -0800)
Return success, but do not screw up the stats.

Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/ReplicatedPG.cc
src/test/librados/tier.cc

index f1df651bf7e8510c30b1d8b905d7b9a9ddc126f3..e17b67070e9753bf499b052a8bbd5e0cffcf41db 100644 (file)
@@ -2885,9 +2885,12 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
     case CEPH_OSD_OP_UNDIRTY:
       ++ctx->num_write;
       {
-       ctx->undirty = true;  // see make_writeable()
-       ctx->modify = true;
-       ctx->delta_stats.num_wr++;
+       if (oi.is_dirty()) {
+         ctx->undirty = true;  // see make_writeable()
+         ctx->modify = true;
+         ctx->delta_stats.num_wr++;
+       }
+       result = 0;
       }
       break;
 
@@ -4161,6 +4164,7 @@ void ReplicatedPG::make_writeable(OpContext *ctx)
     // we will mark the object dirty
     if (ctx->undirty) {
       dout(20) << " clearing DIRTY flag" << dendl;
+      assert(ctx->new_obs.oi.is_dirty());
       ctx->new_obs.oi.clear_flag(object_info_t::FLAG_DIRTY);
       --ctx->delta_stats.num_objects_dirty;
     } else if (!ctx->new_obs.oi.test_flag(object_info_t::FLAG_DIRTY)) {
index d0ab530f0346ef722c53fd2596df5f42625aea2d..e12db70f87237ca733171b87cc91f44676165704 100644 (file)
@@ -61,6 +61,11 @@ TEST(LibRadosTier, Dirty) {
     op.undirty();
     ASSERT_EQ(0, ioctx.operate("foo", &op));
   }
+  {
+    ObjectWriteOperation op;
+    op.undirty();
+    ASSERT_EQ(0, ioctx.operate("foo", &op));  // still 0 if already clean
+  }
   {
     bool dirty = false;
     int r = -1;