From: Zhiqiang Wang Date: Wed, 6 May 2015 08:14:29 +0000 (+0800) Subject: librbd: fix the image format detection X-Git-Tag: v9.0.2~232^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=835b12ff6dcd7a08944c3e71eba96bbd4c938710;p=ceph.git librbd: fix the image format detection 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 --- diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index bb2413632108..809dfee90b75 100644 --- a/src/librbd/internal.cc +++ b/src/librbd/internal.cc @@ -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 << " : "