]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/SessionMap: interpret bare id as a valid filter
authorSage Weil <sage@redhat.com>
Fri, 15 Nov 2019 18:31:46 +0000 (12:31 -0600)
committerSage Weil <sage@redhat.com>
Thu, 12 Dec 2019 19:31:26 +0000 (13:31 -0600)
This works around the fact that the old asok 'session evict' took a bare
id and the tell version took a filter.

Signed-off-by: Sage Weil <sage@redhat.com>
src/mds/SessionMap.cc

index 854d575a8ea145982f49ff8657bbaea203e3f0f7..d4b32d8223553ef467a8ebd6281385f4d5905f17 100644 (file)
@@ -1103,8 +1103,15 @@ int SessionFilter::parse(
 
     auto eq = s.find("=");
     if (eq == std::string::npos || eq == s.size()) {
-      *ss << "Invalid filter '" << s << "'";
-      return -EINVAL;
+      // allow this to be a bare id for compatibility with pre-octopus asok
+      // 'session evict'.
+      std::string err;
+      id = strict_strtoll(s.c_str(), 10, &err);
+      if (!err.empty()) {
+       *ss << "Invalid filter '" << s << "'";
+       return -EINVAL;
+      }
+      return 0;
     }
 
     // Keys that start with this are to be taken as referring