]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: do string equality comparison
authorPatrick Donnelly <pdonnell@redhat.com>
Sat, 7 Mar 2020 03:09:50 +0000 (19:09 -0800)
committerPatrick Donnelly <pdonnell@redhat.com>
Thu, 2 Jul 2020 00:19:53 +0000 (17:19 -0700)
The string::find method would return true for ceph.dir.pin even for the
other ephemeral pin xattr names. For this reason, it was never possible
to actually turn ephemeral pins on!

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit 21872bdb118c5eef4c2cfdadcc62737bb9471022)

src/mds/Server.cc

index ebc75d10444ac52ddbffad78d773669133bf813b..c780658eed160930eef9c2adfa9429316398c70a 100644 (file)
@@ -5603,7 +5603,7 @@ void Server::handle_set_vxattr(MDRequestRef& mdr, CInode *cur)
 
     client_t exclude_ct = mdr->get_client();
     mdcache->broadcast_quota_to_client(cur, exclude_ct, true);
-  } else if (name.find("ceph.dir.pin") == 0) {
+  } else if (name == "ceph.dir.pin"sv) {
     if (!cur->is_dir() || cur->is_root()) {
       respond_to_request(mdr, -EINVAL);
       return;
@@ -5625,7 +5625,7 @@ void Server::handle_set_vxattr(MDRequestRef& mdr, CInode *cur)
     auto &pi = cur->project_inode();
     cur->set_export_pin(rank);
     pip = &pi.inode;
-  }  else if (name.find("ceph.dir.pin.random") == 0) {
+  } else if (name == "ceph.dir.pin.random"sv) {
     if (!cur->is_dir() || cur->is_root()) {
       respond_to_request(mdr, -EINVAL);
       return;
@@ -5646,7 +5646,7 @@ void Server::handle_set_vxattr(MDRequestRef& mdr, CInode *cur)
     auto &pi = cur->project_inode();
     cur->set_export_ephemeral_random_pin(val);
     pip = &pi.inode;
-  } else if (name.find("ceph.dir.pin.distributed") == 0) {
+  } else if (name == "ceph.dir.pin.distributed"sv) {
     if (!cur->is_dir() || cur->is_root()) {
       respond_to_request(mdr, -EINVAL);
       return;