]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: validate if dst group snap name is equal to src 20395/head
authorsongweibin <song.weibin@zte.com.cn>
Sun, 11 Feb 2018 07:12:23 +0000 (15:12 +0800)
committersongweibin <song.weibin@zte.com.cn>
Sun, 11 Feb 2018 07:12:23 +0000 (15:12 +0800)
Signed-off-by: songweibin <song.weibin@zte.com.cn>
src/librbd/api/Group.cc
src/librbd/api/Group.h

index 4f47562051527451f94b722c8b89602a8b4509ea..99fea4a568da375f9d906e406d0aa9488814bdfe 100644 (file)
@@ -938,6 +938,8 @@ int Group<I>::snap_rename(librados::IoCtx& group_ioctx, const char *group_name,
                           const char *old_snap_name,
                           const char *new_snap_name) {
   CephContext *cct = (CephContext *)group_ioctx.cct();
+  if (0 == strcmp(old_snap_name, new_snap_name))
+    return -EEXIST;
 
   std::string group_id;
   int r = cls_client::dir_get_id(&group_ioctx, RBD_GROUP_DIRECTORY,
index 7f7e973c90f5cfc6e37eb2c04d7557669bed2f41..37cb82f7f72b8053947f1c72fac91452b0df710f 100644 (file)
@@ -19,7 +19,7 @@ namespace api {
 template <typename ImageCtxT = librbd::ImageCtx>
 struct Group {
 
-  static int create(librados::IoCtx& io_ctx, const char *imgname);
+  static int create(librados::IoCtx& io_ctx, const char *group_name);
   static int remove(librados::IoCtx& io_ctx, const char *group_name);
   static int list(librados::IoCtx& io_ctx, std::vector<std::string> *names);