]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ObjectCacher: retry reads when they are incomplete
authorJosh Durgin <josh.durgin@inktank.com>
Fri, 16 Nov 2012 20:26:16 +0000 (12:26 -0800)
committerJosh Durgin <josh.durgin@inktank.com>
Fri, 16 Nov 2012 23:22:27 +0000 (15:22 -0800)
Skipping these callbacks when there's a racing write or
a gap in the results causes the original reads they represent
to never be completed. If the read falls within the range
of a BufferHead, retry all waiters no matter what.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
src/osdc/ObjectCacher.cc

index 48df3c3114f9c15dc2b30f465499d072566d4f99..16ac3ae96c4265eea38c9fd051d4d5dc8cba27e3 100644 (file)
@@ -599,8 +599,6 @@ void ObjectCacher::bh_read_finish(int64_t poolid, sobject_t oid, loff_t start,
       //   reply to first 1~1 -> ooo ENOENT
       for (map<loff_t, BufferHead*>::iterator p = ob->data.begin(); p != ob->data.end(); ++p) {
        BufferHead *bh = p->second;
-       if (!bh->is_rx())
-         continue;
        for (map<loff_t, list<Context*> >::iterator p = bh->waitfor_read.begin();
             p != bh->waitfor_read.end();
             p++)
@@ -620,6 +618,13 @@ void ObjectCacher::bh_read_finish(int64_t poolid, sobject_t oid, loff_t start,
 
       BufferHead *bh = p->second;
       
+      // finishers?
+      for (map<loff_t, list<Context*> >::iterator it = bh->waitfor_read.begin();
+           it != bh->waitfor_read.end();
+           it++)
+       ls.splice(ls.end(), it->second);
+      bh->waitfor_read.clear();
+
       if (bh->start() > opos) {
         ldout(cct, 1) << "weirdness: gap when applying read results, " 
                 << opos << "~" << bh->start() - opos 
@@ -627,24 +632,18 @@ void ObjectCacher::bh_read_finish(int64_t poolid, sobject_t oid, loff_t start,
         opos = bh->start();
         continue;
       }
-      
+
       if (!bh->is_rx()) {
         ldout(cct, 10) << "bh_read_finish skipping non-rx " << *bh << dendl;
         opos = bh->end();
         p++;
         continue;
       }
-      
+
       assert(opos >= bh->start());
       assert(bh->start() == opos);   // we don't merge rx bh's... yet!
       assert(bh->length() <= start+(loff_t)length-opos);
 
-      // finishers?
-      for (map<loff_t, list<Context*> >::iterator p = bh->waitfor_read.begin();
-           p != bh->waitfor_read.end();
-           p++)
-        ls.splice(ls.end(), p->second);
-      bh->waitfor_read.clear();
       if (bh->error < 0)
        err = bh->error;