]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: use either dentry_invalidate_cb or remount_cb to invalidate kernel dcache 21189/head
authorZhi Zhang <willzzhang@tencent.com>
Mon, 5 Mar 2018 03:04:36 +0000 (11:04 +0800)
committerNathan Cutler <ncutler@suse.com>
Tue, 3 Apr 2018 02:58:54 +0000 (04:58 +0200)
Signed-off-by: Zhi Zhang <zhangz.david@outlook.com>
(cherry picked from commit 6b823dc250223c2c25c341d6ffcfa64510f47bb2)

src/client/Client.cc

index 5e2e6201f6772e31237dedeeb38e256432669ede..9680e6c3561dc20d6469b974e23a31c553f686ec 100644 (file)
@@ -3967,12 +3967,14 @@ void Client::_invalidate_kernel_dcache()
 {
   if (unmounting)
     return;
-  if (can_invalidate_dentries && dentry_invalidate_cb && root->dir) {
-    for (ceph::unordered_map<string, Dentry*>::iterator p = root->dir->dentries.begin();
-        p != root->dir->dentries.end();
-        ++p) {
-      if (p->second->inode)
-       _schedule_invalidate_dentry_callback(p->second, false);
+  if (can_invalidate_dentries) {
+    if (dentry_invalidate_cb && root->dir) {
+      for (ceph::unordered_map<string, Dentry*>::iterator p = root->dir->dentries.begin();
+         p != root->dir->dentries.end();
+         ++p) {
+       if (p->second->inode)
+        _schedule_invalidate_dentry_callback(p->second, false);
+      }
     }
   } else if (remount_cb) {
     // Hacky: