]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/ECBackend: don't get result code of subchunk-read overwritten 24342/head
authorKefu Chai <kchai@redhat.com>
Sun, 30 Sep 2018 14:25:49 +0000 (22:25 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 30 Sep 2018 14:25:50 +0000 (22:25 +0800)
Fixes: http://tracker.ceph.com/issues/21769
Signed-off-by: songweibin <song.weibin@zte.com.cn>
(cherry picked from commit 4692f995ba6967796d5dd2f5fd85fde8705a1ccc)

Conflicts:
src/osd/ECBackend.cc:
          master contains changes from
          33d79f303d945c8d6d2e9e9a471efc4df57617a6, but luminous
          does, so we don't need to consider the case of fragmented
          read.

src/osd/ECBackend.cc

index 23e5a50f0166ceb891f11e602ea81503f0412307..fef3c03d1514b5d86e29cee571c9c7ad5dee19d9 100644 (file)
@@ -1000,17 +1000,6 @@ void ECBackend::handle_sub_read(
       i != op.to_read.end();
       ++i) {
     int r = 0;
-    ECUtil::HashInfoRef hinfo;
-    if (!get_parent()->get_pool().allows_ecoverwrites()) {
-      hinfo = get_hash_info(i->first);
-      if (!hinfo) {
-       r = -EIO;
-       get_parent()->clog_error() << "Corruption detected: object " << i->first
-                                   << " is missing hash_info";
-       dout(5) << __func__ << ": No hinfo for " << i->first << dendl;
-       goto error;
-      }
-    }
     for (auto j = i->second.begin(); j != i->second.end(); ++j) {
       bufferlist bl;
       r = store->read(
@@ -1039,6 +1028,17 @@ void ECBackend::handle_sub_read(
        // This shows that we still need deep scrub because large enough files
        // are read in sections, so the digest check here won't be done here.
        // Do NOT check osd_read_eio_on_bad_digest here.  We need to report
+       ECUtil::HashInfoRef hinfo;
+       if (!get_parent()->get_pool().allows_ecoverwrites()) {
+         hinfo = get_hash_info(i->first);
+         if (!hinfo) {
+           r = -EIO;
+           get_parent()->clog_error() << "Corruption detected: object " << i->first
+                                      << " is missing hash_info";
+           dout(5) << __func__ << ": No hinfo for " << i->first << dendl;
+           goto error;
+         }
+       }
        // the state of our chunk in case other chunks could substitute.
        assert(hinfo->has_chunk_hash());
        if ((bl.length() == hinfo->get_total_chunk_size()) &&