]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: change unfound handling when using localize
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Tue, 1 Feb 2011 14:22:02 +0000 (06:22 -0800)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Wed, 2 Feb 2011 11:56:45 +0000 (03:56 -0800)
Change how cosd handles unfound objects when doing operations with
localize_reads. Specifically, don't wait for unfound objects unless we
are the primary for the relevant PG.

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
src/osd/ReplicatedPG.cc

index 2c415a69326d23339e8bad62f59ae9255fe03020..8ae5d40caaa9ebd656dff8ab3c29be240fd4a470 100644 (file)
@@ -349,13 +349,19 @@ void ReplicatedPG::do_op(MOSDOp *op)
   snapid_t snapid;
   int r = find_object_context(op->get_oid(), op->get_object_locator(),
                              op->get_snapid(), &obc, can_create, &snapid);
+
   if (r) {
     if (r == -EAGAIN) {
-      // missing the specific snap we need; requeue and wait.
-      assert(!can_create); // only happens on a read
-      sobject_t soid(op->get_oid(), snapid);
-      wait_for_missing_object(soid, op);
-      return;
+      // If we're not the primary of this OSD, and we have
+      // CEPH_OSD_FLAG_LOCALIZE_READS set, we just return -EAGAIN. Otherwise,
+      // we have to wait for the object.
+      if (is_primary() || (!(op->get_rmw_flags() & CEPH_OSD_FLAG_LOCALIZE_READS))) {
+       // missing the specific snap we need; requeue and wait.
+       assert(!can_create); // only happens on a read
+       sobject_t soid(op->get_oid(), snapid);
+       wait_for_missing_object(soid, op);
+       return;
+      }
     }
     osd->reply_op_error(op, r);
     return;