]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
BlueStore: skip CRC verification if unable to read label
authorxie xingguo <xie.xingguo@zte.com.cn>
Wed, 6 Jan 2016 07:02:12 +0000 (15:02 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Thu, 14 Jan 2016 05:45:34 +0000 (13:45 +0800)
Fixes: #14259
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/bluestore/BlueStore.cc

index 9b1641464445ef176219b0fc4b5c7e05133649cf..a28fb16d488f48e475fe6d3b14a39a4017ed9558 100644 (file)
@@ -874,18 +874,19 @@ int BlueStore::_read_bdev_label(string path, bluestore_bdev_label_t *label)
   dout(10) << __func__ << dendl;
   int fd = ::open(path.c_str(), O_RDONLY);
   if (fd < 0) {
-    fd = errno;
+    fd = -errno;
     derr << __func__ << " failed to open " << path << ": " << cpp_strerror(fd)
         << dendl;
     return fd;
   }
   bufferlist bl;
   int r = bl.read_fd(fd, BDEV_LABEL_BLOCK_SIZE);
+  VOID_TEMP_FAILURE_RETRY(::close(fd));
   if (r < 0) {
     derr << __func__ << " failed to read from " << path
         << ": " << cpp_strerror(r) << dendl;
+    return r;
   }
-  VOID_TEMP_FAILURE_RETRY(::close(fd));
 
   uint32_t crc, expected_crc;
   bufferlist::iterator p = bl.begin();