From 30fa7fbbc08bf521204ce838768fdb552b73c2dd Mon Sep 17 00:00:00 2001 From: zhengyin Date: Mon, 11 Jun 2018 16:42:47 +0800 Subject: [PATCH] rbd/resize: if new size is equal to original size, raise error Signed-off-by: Zheng Yin zhengyin@cmss.chinamobile.com --- src/tools/rbd/action/Resize.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tools/rbd/action/Resize.cc b/src/tools/rbd/action/Resize.cc index aed5fdad1375..fdb3fcf0ac70 100644 --- a/src/tools/rbd/action/Resize.cc +++ b/src/tools/rbd/action/Resize.cc @@ -71,6 +71,11 @@ int execute(const po::variables_map &vm, return r; } + if (info.size == size) { + std::cerr << "rbd: new size is equal to original size " << std::endl; + return -EINVAL; + } + if (info.size > size && !vm["allow-shrink"].as()) { r = -EINVAL; } else { -- 2.47.3