]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: switch to old method to invalidate dcache if euid != 0 49944/head
authorXiubo Li <xiubli@redhat.com>
Thu, 20 Oct 2022 04:16:55 +0000 (12:16 +0800)
committerXiubo Li <xiubli@redhat.com>
Fri, 10 Mar 2023 05:49:39 +0000 (13:49 +0800)
Force to use the old and slow method to invalidate the dcache
if the euid is non-root, or the remount may fail with return
code 1 or 32.

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

src/client/Client.cc

index 3139dc96227ca43324d006367cb09fcf018b7460..abb90b006e97626f9d0c7d7c8d3770bd1a553b81 100644 (file)
@@ -11624,6 +11624,17 @@ std::pair<int, bool> Client::test_dentry_handling(bool can_invalidate)
 
   can_invalidate_dentries = can_invalidate;
 
+  /*
+   * Force to use the old and slow method to invalidate the dcache
+   * if the euid is non-root, or the remount may fail with return
+   * code 1 or 32.
+   */
+  uid_t euid = geteuid();
+  ldout(cct, 10) << "euid: " << euid << dendl;
+  if (euid != 0) {
+    can_invalidate_dentries = true;
+  }
+
   if (can_invalidate_dentries) {
     ceph_assert(dentry_invalidate_cb);
     ldout(cct, 1) << "using dentry_invalidate_cb" << dendl;