]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mds: add MDSCapAuth support
authorXiubo Li <xiubli@redhat.com>
Tue, 20 Dec 2022 04:39:22 +0000 (12:39 +0800)
committerXiubo Li <xiubli@redhat.com>
Wed, 27 Mar 2024 00:42:40 +0000 (08:42 +0800)
Need to add writeable/readable members and send them back to clients.

Fixes: https://tracker.ceph.com/issues/57154
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit 6e4a6448022051ba9a33f4cb4b0af2298f2622aa)

src/CMakeLists.txt
src/crimson/CMakeLists.txt
src/mds/CMakeLists.txt
src/mds/MDSAuthCaps.cc
src/mds/MDSAuthCaps.h

index af33d4d6affeaae42f4f773ae94f33a790c43dce..f91dd1abe7fcb97f289bab547378c2b5cb2dd626 100644 (file)
@@ -302,6 +302,7 @@ endif(WITH_BLKIN)
 set(mds_files)
 list(APPEND mds_files
   mds/MDSMap.cc
+  mds/MDSAuthCaps.cc
   mds/FSMap.cc
   mds/FSMapUser.cc
   mds/inode_backtrace.cc
index e2b37fac9cbf0335eec80381d444caee710d728a..723e6cb55f081fc6456f8485e4d618d4508d1002 100644 (file)
@@ -110,6 +110,7 @@ add_library(crimson-common STATIC
   ${PROJECT_SOURCE_DIR}/src/mds/FSMap.cc
   ${PROJECT_SOURCE_DIR}/src/mds/FSMapUser.cc
   ${PROJECT_SOURCE_DIR}/src/mds/MDSMap.cc
+  ${PROJECT_SOURCE_DIR}/src/mds/MDSAuthCaps.cc
   ${PROJECT_SOURCE_DIR}/src/msg/msg_types.cc
   ${PROJECT_SOURCE_DIR}/src/msg/Message.cc
   ${PROJECT_SOURCE_DIR}/src/mon/PGMap.cc
index a12898f38c78e6f62399a19690f254ecc2ce56ae..88c8a1db0854aaabeee0c56bc160511da0cb8532 100644 (file)
@@ -34,7 +34,6 @@ set(mds_srcs
   snap.cc
   SessionMap.cc
   MDSContext.cc
-  MDSAuthCaps.cc
   MDLog.cc
   MDSCacheObject.cc
   Mantle.cc
index e428707247569b66fcbb69db79b4db72612524d4..03b6413b15b6e8f60919454a1ec5381733cc64c9 100644 (file)
@@ -456,3 +456,9 @@ ostream &operator<<(ostream &out, const MDSAuthCaps &cap)
   return out;
 }
 
+ostream &operator<<(ostream &out, const MDSCapAuth &auth)
+{
+  out << "MDSCapAuth(" << auth.match << "readable="
+      << auth.readable << ", writeable=" << auth.writeable << ")";
+  return out;
+}
index 266bc27c7e806a16c84cba35a8273d46f3155c54..16282bca9b8204c3cea1e8cc50098371a49883c4 100644 (file)
@@ -175,6 +175,40 @@ struct MDSCapMatch {
 };
 WRITE_CLASS_ENCODER(MDSCapMatch)
 
+struct MDSCapAuth {
+  MDSCapAuth() {}
+  MDSCapAuth(MDSCapMatch m, bool r, bool w) :
+    match(m), readable(r), writeable(w) {}
+
+  const MDSCapAuth& operator=(const MDSCapAuth& m) {
+    match = m.match;
+    readable = m.readable;
+    writeable = m.writeable;
+    return *this;
+  }
+
+  void encode(ceph::buffer::list& bl) const {
+    ENCODE_START(1, 1, bl);
+    encode(match, bl);
+    encode(readable, bl);
+    encode(writeable, bl);
+    ENCODE_FINISH(bl);
+  }
+
+  void decode(ceph::buffer::list::const_iterator& p) {
+    DECODE_START(1, p);
+    decode(match, p);
+    decode(readable, p);
+    decode(writeable, p);
+    DECODE_FINISH(p);
+  }
+
+  MDSCapMatch match;
+  bool readable;
+  bool writeable;
+};
+WRITE_CLASS_ENCODER(MDSCapAuth)
+
 struct MDSCapGrant {
   MDSCapGrant(const MDSCapSpec &spec_, const MDSCapMatch &match_,
              boost::optional<std::string> n)
@@ -248,6 +282,7 @@ private:
 };
 
 std::ostream &operator<<(std::ostream &out, const MDSCapMatch &match);
+std::ostream &operator<<(std::ostream &out, const MDSCapAuth &auth);
 std::ostream &operator<<(std::ostream &out, const MDSCapSpec &spec);
 std::ostream &operator<<(std::ostream &out, const MDSCapGrant &grant);
 std::ostream &operator<<(std::ostream &out, const MDSAuthCaps &cap);