]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG: fix CEPH_OSD_OP_CREATE on cache pools 1602/head
authorIlya Dryomov <ilya.dryomov@inktank.com>
Fri, 4 Apr 2014 13:40:29 +0000 (17:40 +0400)
committerIlya Dryomov <ilya.dryomov@inktank.com>
Fri, 4 Apr 2014 16:23:14 +0000 (20:23 +0400)
The following

./ceph osd pool create data-cache 8 8
./ceph osd tier add data data-cache
./ceph osd tier cache-mode data-cache writeback
./ceph osd tier set-overlay data data-cache

./rados -p data create foo
./rados -p data stat foo

results in

  error stat-ing data/foo: No such file or directory

even though foo exists in the data-cache pool, as it should.  STAT
checks for (exists && !is_whiteout()), but the whiteout flag isn't
cleared on CREATE as it is on WRITE and WRITEFULL.  The problem is
that, for newly created 0-sized cache pool objects, CREATE handler in
do_osd_ops() doesn't get a chance to queue OP_TOUCH, and so the logic
in prepare_transaction() considers CREATE to be a read and therefore
doesn't clear whiteout.  Fix it by allowing CREATE handler to queue
OP_TOUCH at all times, mimicking WRITE and WRITEFULL behaviour.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
src/osd/ReplicatedPG.cc

index 3f729b28421a6273fe0b9a082a52c586af6a8156..ed07e82fd7c9352a5db4d3cb9848dbf0de51a9d6 100644 (file)
@@ -3748,12 +3748,15 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
              }
            }
          }
-         if (result >= 0 && !obs.exists) {
-           ctx->mod_desc.create();
-           t->touch(soid);
-           ctx->delta_stats.num_objects++;
-           obs.exists = true;
-         }
+          if (result >= 0) {
+            if (!obs.exists)
+              ctx->mod_desc.create();
+            t->touch(soid);
+            if (!obs.exists) {
+              ctx->delta_stats.num_objects++;
+              obs.exists = true;
+            }
+          }
        }
       }
       break;