]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: fix the image format detection 4558/head
authorZhiqiang Wang <zhiqiang.wang@intel.com>
Wed, 6 May 2015 08:14:29 +0000 (16:14 +0800)
committerZhiqiang Wang <zhiqiang.wang@intel.com>
Wed, 6 May 2015 08:14:29 +0000 (16:14 +0800)
If the detection of the old format fails with reasons other than
-ENOENT, we should return with this error. Otherwise, if we continue the
new format detection and fail with -ENOENT, the caller will get the
missleading failure information.

Signed-off-by: Zhiqiang Wang <zhiqiang.wang@intel.com>
src/librbd/internal.cc

index bb24136321081c65f7360e43543669ac2a367b74..809dfee90b759ad14ecf761b2517fe84aa74f0dd 100644 (file)
@@ -311,12 +311,14 @@ int invoke_async_request(ImageCtx *ictx, const std::string& request_type,
     if (old_format)
       *old_format = true;
     int r = io_ctx.stat(old_header_name(name), size, NULL);
-    if (r < 0) {
+    if (r == -ENOENT) {
       if (old_format)
        *old_format = false;
       r = io_ctx.stat(id_obj_name(name), size, NULL);
       if (r < 0)
        return r;
+    } else if (r < 0) {
+      return r;
     }
 
     ldout(cct, 20) << "detect format of " << name << " : "