From: Sage Weil Date: Tue, 26 Apr 2011 19:10:12 +0000 (-0700) Subject: osd: add RWORDERED osd op flag X-Git-Tag: v0.27.1~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b08ee2c6341a1a52356972f8e48bd8b3de9136bf;p=ceph.git osd: add RWORDERED osd op flag 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 --- diff --git a/src/include/rados.h b/src/include/rados.h index 0ed075f553c3..09dc3e097dd1 100644 --- a/src/include/rados.h +++ b/src/include/rados.h @@ -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 { diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 596ecb047a73..ba76b0512b81 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -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); diff --git a/src/osdc/Filer.cc b/src/osdc/Filer.cc index 4690ce9b6e88..335a879fd0a2 100644 --- a/src/osdc/Filer.cc +++ b/src/osdc/Filer.cc @@ -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); } }