[PATCH 27/29] mds: check if stray dentry is needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Yan, Zheng" <zheng.z.yan@xxxxxxxxx>

The necessity of stray dentry can change before the request acquires
all locks.

Signed-off-by: Yan, Zheng <zheng.z.yan@xxxxxxxxx>
---
 src/mds/Server.cc | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/mds/Server.cc b/src/mds/Server.cc
index 2531005..1557b30 100644
--- a/src/mds/Server.cc
+++ b/src/mds/Server.cc
@@ -4531,11 +4531,14 @@ void Server::handle_client_unlink(MDRequest *mdr)
 
   // -- create stray dentry? --
   CDentry *straydn = mdr->straydn;
-  if (dnl->is_primary() && !straydn) {
-    straydn = mdcache->get_or_create_stray_dentry(dnl->get_inode());
-    mdr->pin(straydn);
-    mdr->straydn = straydn;
-  }
+  if (dnl->is_primary()) {
+    if (!straydn) {
+      straydn = mdcache->get_or_create_stray_dentry(dnl->get_inode());
+      mdr->pin(straydn);
+      mdr->straydn = straydn;
+    }
+  } else if (straydn)
+    straydn = NULL;
   if (straydn)
     dout(10) << " straydn is " << *straydn << dendl;
 
@@ -5274,11 +5277,14 @@ void Server::handle_client_rename(MDRequest *mdr)
 
   // -- create stray dentry? --
   CDentry *straydn = mdr->straydn;
-  if (destdnl->is_primary() && !linkmerge && !straydn) {
-    straydn = mdcache->get_or_create_stray_dentry(destdnl->get_inode());
-    mdr->pin(straydn);
-    mdr->straydn = straydn;
-  }
+  if (destdnl->is_primary() && !linkmerge) {
+    if (!straydn) {
+      straydn = mdcache->get_or_create_stray_dentry(destdnl->get_inode());
+      mdr->pin(straydn);
+      mdr->straydn = straydn;
+    }
+  } else if (straydn)
+    straydn = NULL;
   if (straydn)
     dout(10) << " straydn is " << *straydn << dendl;
 
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux