From: Abutalib Aghayev Date: Fri, 3 Jul 2020 02:16:35 +0000 (-0400) Subject: bluestore: Fix handling the return value of zbc_device_is_zoned() call. X-Git-Tag: wip-pdonnell-testing-20200918.022351~743^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4bca2ccf92cd9ea432471fe7a3c2115c08afe5d1;p=ceph-ci.git bluestore: Fix handling the return value of zbc_device_is_zoned() call. zbc_device_is_zoned() returns 1 when the device is zoned and 0 when the device is not zoned. It may return a negative value in case of error, for example, if the user does not have access to the device. Signed-off-by: Abutalib Aghayev --- diff --git a/src/blk/BlockDevice.cc b/src/blk/BlockDevice.cc index 4e1affed6b3..8a6763b448d 100644 --- a/src/blk/BlockDevice.cc +++ b/src/blk/BlockDevice.cc @@ -131,9 +131,15 @@ BlockDevice *BlockDevice::create(CephContext* cct, const string& path, #endif #if defined(HAVE_LIBAIO) || defined(HAVE_POSIXAIO) #if defined(HAVE_LIBZBC) - if (zbc_device_is_zoned(path.c_str(), false, nullptr)) { + r = zbc_device_is_zoned(path.c_str(), false, nullptr); + if (r == 1) { return new HMSMRDevice(cct, cb, cbpriv, d_cb, d_cbpriv); } + if (r < 0) { + derr << __func__ << " zbc_device_is_zoned(" << path << ") failed: " + << cpp_strerror(r) << dendl; + goto out_fail; + } #endif if (type == "kernel") { return new KernelDevice(cct, cb, cbpriv, d_cb, d_cbpriv); @@ -148,6 +154,8 @@ BlockDevice *BlockDevice::create(CephContext* cct, const string& path, #endif derr << __func__ << " unknown backend " << type << dendl; + +out_fail: ceph_abort(); return NULL; }