From: xie xingguo Date: Wed, 6 Jan 2016 07:02:12 +0000 (+0800) Subject: BlueStore: skip CRC verification if unable to read label X-Git-Tag: v10.0.3~42^2~15 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=295cdd6077d31dd4b11a34a07a668145cef1b3d0;p=ceph.git BlueStore: skip CRC verification if unable to read label Fixes: #14259 Signed-off-by: xie xingguo --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 9b164146444..a28fb16d488 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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();