]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: add RWORDERED osd op flag
authorSage Weil <sage.weil@dreamhost.com>
Tue, 26 Apr 2011 19:10:12 +0000 (12:10 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Tue, 26 Apr 2011 19:10:12 +0000 (12:10 -0700)
Order this op wrt reads the same way a read-modify-write would be.
(Otherwise we may get a fast/stale read result on a not-yet-complete
write.)

This fixes a problem where the Filer was marking a probe stat as a write
to get this same effect, but the OSD would EINVAL if it was a snapped
object (which happens in certain cases where the MDS is recovering the
file size of a snapped file).

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/include/rados.h
src/osd/ReplicatedPG.cc
src/osdc/Filer.cc

index 0ed075f553c3547608f9e89e2f8155808a4aa00c..09dc3e097dd15354fce24a0da080be77ec9b8c10 100644 (file)
@@ -326,6 +326,7 @@ enum {
        CEPH_OSD_FLAG_EXEC =           0x0800,  /* op may exec */
        CEPH_OSD_FLAG_EXEC_PUBLIC =    0x1000,  /* op may exec (public) */
        CEPH_OSD_FLAG_LOCALIZE_READS = 0x2000,  /* read from nearby replica, if any */
+       CEPH_OSD_FLAG_RWORDERED =      0x4000,  /* order wrt concurrent reads */
 };
 
 enum {
index 596ecb047a7302cfa804eb7a0cd48988c9ecf9e6..ba76b0512b81d0e44b02953bd0f7e3609f3f5a66 100644 (file)
@@ -397,7 +397,8 @@ void ReplicatedPG::do_op(MOSDOp *op)
   bool ok;
   dout(10) << "do_op mode is " << mode << dendl;
   assert(!mode.wake);   // we should never have woken waiters here.
-  if (op->may_read() && op->may_write())
+  if ((op->may_read() && op->may_write()) ||
+      (op->get_flags() & CEPH_OSD_FLAG_RWORDERED))
     ok = mode.try_rmw(client);
   else if (op->may_write())
     ok = mode.try_write(client);
index 4690ce9b6e884925ff45555731f90016a3e87798..335a879fd0a2fb6857cf7cd1cc864be64a4e49c8 100644 (file)
@@ -108,7 +108,7 @@ void Filer::_probe(Probe *probe)
     dout(10) << "_probe  probing " << p->oid << dendl;
     C_Probe *c = new C_Probe(this, probe, p->oid);
     probe->ops[p->oid] = objecter->stat(p->oid, p->oloc, probe->snapid, &c->size, &c->mtime, 
-                                       probe->flags | CEPH_OSD_FLAG_WRITE, c);
+                                       probe->flags | CEPH_OSD_FLAG_RWORDERED, c);
   }
 }