]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Add check for whether RGWObjState was created in dbstore.cc 52338/head
authorVedansh Bhartia <vedanshbhartia@gmail.com>
Thu, 6 Jul 2023 11:51:02 +0000 (17:21 +0530)
committerVedansh Bhartia <vedanshbhartia@gmail.com>
Thu, 6 Jul 2023 11:51:02 +0000 (17:21 +0530)
Signed-off-by: Vedansh Bhartia <vedanshbhartia@gmail.com>
src/rgw/driver/dbstore/common/dbstore.cc

index 3936368e6f7f8057fe394820684ecc1a994c76a2..0b8265a2bf34e08b95a66590d335e326e53bfac9 100644 (file)
@@ -1427,7 +1427,7 @@ int DB::Object::Read::read(int64_t ofs, int64_t end, bufferlist& bl, const DoutP
   if (r < 0)
     return r;
 
-  if (!astate->exists) {
+  if (!astate || !astate->exists) {
     return -ENOENT;
   }
 
@@ -1451,17 +1451,15 @@ int DB::Object::Read::read(int64_t ofs, int64_t end, bufferlist& bl, const DoutP
   bool reading_from_head = (ofs < head_data_size);
 
   if (reading_from_head) {
-    if (astate) { // && astate->prefetch_data)?
-      if (!ofs && astate->data.length() >= len) {
-        bl = astate->data;
-        return bl.length();
-      }
+    if (!ofs && astate->data.length() >= len) {
+      bl = astate->data;
+      return bl.length();
+    }
 
-      if (ofs < astate->data.length()) {
-        unsigned copy_len = std::min((uint64_t)head_data_size - ofs, len);
-        astate->data.begin(ofs).copy(copy_len, bl);
-        return bl.length();
-      }
+    if (ofs < astate->data.length()) {
+      unsigned copy_len = std::min((uint64_t)head_data_size - ofs, len);
+      astate->data.begin(ofs).copy(copy_len, bl);
+      return bl.length();
     }
   }