]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: make the lost+found dir accessible from clients
authorXiubo Li <xiubli@redhat.com>
Mon, 19 Apr 2021 02:34:02 +0000 (10:34 +0800)
committerXiubo Li <xiubli@redhat.com>
Wed, 28 Apr 2021 01:28:23 +0000 (09:28 +0800)
Inode number 0x4 is reserved for the lost+found dir, and the apps
or recovery apps need to access it.

At the same time the 0x3 is reserved for the global snaprealm, which
will also be lookup by the clients when looking up the snaprealm inodes.

Here will make all the inode less than 100 accessible by clients.

Fixes: https://tracker.ceph.com/issues/50216
Signed-off-by: Xiubo Li <xiubli@redhat.com>
src/client/Client.cc
src/mds/Server.cc
src/mds/mdstypes.h

index 98ea0a94feed8d261ec35f56a1d017ec11ec257b..c8849d876d460c7de7b1659e949bd45f32958ddb 100644 (file)
@@ -157,8 +157,8 @@ void client_flush_set_callback(void *p, ObjectCacher::ObjectSet *oset)
 }
 
 bool Client::is_reserved_vino(vinodeno_t &vino) {
-  if (vino.ino < MDS_INO_SYSTEM_BASE && vino.ino != CEPH_INO_ROOT) {
-    ldout(cct, -1) << __func__ << "attempt to access reserved inode number " << vino << dendl;
+  if (MDS_IS_PRIVATE_INO(vino.ino)) {
+    ldout(cct, -1) << __func__ << " attempt to access reserved inode number " << vino << dendl;
     return true;
   }
   return false;
index 04b3aa0ff1b1e0c3306a1a4437909262c544e453..cc93b10d9ba69c6bf42f04c0aff73b69c16c86f2 100644 (file)
@@ -3910,7 +3910,7 @@ void Server::handle_client_lookup_ino(MDRequestRef& mdr,
    *
    * [1] https://tracker.ceph.com/issues/49922
    */
-  if (_ino < MDS_INO_SYSTEM_BASE && _ino != CEPH_INO_ROOT) {
+  if (MDS_IS_PRIVATE_INO(_ino)) {
     respond_to_request(mdr, -CEPHFS_ESTALE);
     return;
   }
index 5e9fb7d04fb02deb166a95c6c5c2320bd4c7ba9f..bfb27910846b2ed6c7d87d4e4f833dc206b6af9f 100644 (file)
@@ -65,6 +65,8 @@
 #define MDS_INO_STRAY_OWNER(i) (signed (((unsigned (i)) - MDS_INO_STRAY_OFFSET) / NUM_STRAY))
 #define MDS_INO_STRAY_INDEX(i) (((unsigned (i)) - MDS_INO_STRAY_OFFSET) % NUM_STRAY)
 
+#define MDS_IS_PRIVATE_INO(i) ((i) < MDS_INO_SYSTEM_BASE && (i) >= MDS_INO_MDSDIR_OFFSET)
+
 typedef int32_t mds_rank_t;
 constexpr mds_rank_t MDS_RANK_NONE             = -1;
 constexpr mds_rank_t MDS_RANK_EPHEMERAL_DIST   = -2;