From: Xiubo Li Date: Mon, 19 Apr 2021 02:34:02 +0000 (+0800) Subject: mds: make the lost+found dir accessible from clients X-Git-Tag: v16.2.5~33^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0c03e18947c25857aacd2e3c21bb6dff25090aaf;p=ceph.git mds: make the lost+found dir accessible from clients 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 (cherry picked from commit 841071b3602aa2b8bcca57b95cdf671d48036a34) --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 819518cfb1a1..d56ad6076e73 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -161,8 +161,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; diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 782c34e7e09d..1d5a47e2060f 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -3916,7 +3916,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; } diff --git a/src/mds/mdstypes.h b/src/mds/mdstypes.h index 5e9fb7d04fb0..bfb27910846b 100644 --- a/src/mds/mdstypes.h +++ b/src/mds/mdstypes.h @@ -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;