All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yan, Zheng" <zheng.z.yan@intel.com>
To: ceph-devel@vger.kernel.org, sage@inktank.com
Cc: "Yan, Zheng" <zheng.z.yan@intel.com>
Subject: [PATCH 02/25] mds: check deleted directory in Server::rdlock_path_xlock_dentry
Date: Wed, 23 Jan 2013 11:08:38 +0800	[thread overview]
Message-ID: <1358910541-15535-3-git-send-email-zheng.z.yan@intel.com> (raw)
In-Reply-To: <1358910541-15535-1-git-send-email-zheng.z.yan@intel.com>

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

Commit b03eab22e4 (mds: forbid creating file in deleted directory)
is not complete, mknod, mkdir and symlink are missed. Move the ckeck
into Server::rdlock_path_xlock_dentry() fixes the issue.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
---
 src/mds/CInode.cc |  5 +----
 src/mds/CInode.h  |  2 --
 src/mds/Server.cc | 25 ++++++++++---------------
 3 files changed, 11 insertions(+), 21 deletions(-)

diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc
index 3009f0c..ebc94ba 100644
--- a/src/mds/CInode.cc
+++ b/src/mds/CInode.cc
@@ -245,10 +245,7 @@ void CInode::print(ostream& out)
   out << *this;
 }
 
-bool CInode::is_in_stray()
-{
-  return !is_base() && get_projected_parent_dir()->inode->is_stray();
-}
+
 
 void CInode::add_need_snapflush(CInode *snapin, snapid_t snapid, client_t client)
 {
diff --git a/src/mds/CInode.h b/src/mds/CInode.h
index 140353d..f2de6e5 100644
--- a/src/mds/CInode.h
+++ b/src/mds/CInode.h
@@ -524,8 +524,6 @@ private:
 
   bool is_head() { return last == CEPH_NOSNAP; }
 
-  bool is_in_stray();
-
   // note: this overloads MDSCacheObject
   bool is_ambiguous_auth() {
     return state_test(STATE_AMBIGUOUSAUTH) ||
diff --git a/src/mds/Server.cc b/src/mds/Server.cc
index 45eed81..ebdbfe4 100644
--- a/src/mds/Server.cc
+++ b/src/mds/Server.cc
@@ -2019,9 +2019,15 @@ CDentry* Server::rdlock_path_xlock_dentry(MDRequest *mdr, int n,
   }
 
   CInode *diri = dir->get_inode();
-  if (!mdr->reqid.name.is_mds() && diri->is_system() && !diri->is_root()) {
-    reply_request(mdr, -EROFS);
-    return 0;
+  if (!mdr->reqid.name.is_mds()) {
+    if (diri->is_system() && !diri->is_root()) {
+      reply_request(mdr, -EROFS);
+      return 0;
+    }
+    if (!diri->is_base() && diri->get_projected_parent_dir()->inode->is_stray()) {
+      reply_request(mdr, -ENOENT);
+      return 0;
+    }
   }
 
   // make a null dentry?
@@ -2641,13 +2647,6 @@ void Server::handle_client_openc(MDRequest *mdr)
     reply_request(mdr, -EROFS);
     return;
   }
-
-  CInode *diri = dn->get_dir()->get_inode();
-  if (diri->is_in_stray()) {
-    reply_request(mdr, -ENOENT);
-    return;
-  }
-
   // set layout
   ceph_file_layout layout;
   if (dir_layout)
@@ -2684,6 +2683,7 @@ void Server::handle_client_openc(MDRequest *mdr)
     return;
   }
 
+  CInode *diri = dn->get_dir()->get_inode();
   rdlocks.insert(&diri->authlock);
   if (!mds->locker->acquire_locks(mdr, rdlocks, wrlocks, xlocks))
     return;
@@ -5140,11 +5140,6 @@ void Server::handle_client_rename(MDRequest *mdr)
   CDir *destdir = destdn->get_dir();
   assert(destdir->is_auth());
 
-  if (destdir->get_inode()->is_in_stray()) {
-    reply_request(mdr, -ENOENT);
-    return;
-  }
-
   int r = mdcache->path_traverse(mdr, NULL, NULL, srcpath, &srctrace, NULL, MDS_TRAVERSE_DISCOVER);
   if (r > 0)
     return; // delayed
-- 
1.7.11.7


  parent reply	other threads:[~2013-01-23  3:09 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-23  3:08 [PATCH 00/24] fixes for MDS cluster recovery Yan, Zheng
2013-01-23  3:08 ` [PATCH 01/25] mds: fix end check in Server::handle_client_readdir() Yan, Zheng
2013-01-23 17:17   ` Sage Weil
2013-01-24  2:16     ` Yan, Zheng
2013-01-23  3:08 ` Yan, Zheng [this message]
2013-01-23  3:08 ` [PATCH 03/25] mds: lock remote inode's primary dentry during rename Yan, Zheng
2013-01-23  3:08 ` [PATCH 04/25] mds: allow journaling multiple root inodes in EMetaBlob Yan, Zheng
2013-01-23  3:08 ` [PATCH 05/25] mds: introduce XSYN to SYNC lock state transition Yan, Zheng
2013-01-23  3:08 ` [PATCH 06/25] mds: properly set error_dentry for discover reply Yan, Zheng
2013-01-23  3:08 ` [PATCH 07/25] mds: don't early reply rename Yan, Zheng
2013-01-28 21:44   ` Sage Weil
2013-01-29  1:44     ` Yan, Zheng
2013-01-29  2:23       ` Sage Weil
2013-01-29  2:56         ` Yan, Zheng
2013-01-23  3:08 ` [PATCH 08/25] mds: fix "had dentry linked to wrong inode" warning Yan, Zheng
2013-01-23  3:08 ` [PATCH 09/25] mds: splits rename force journal check into separate function Yan, Zheng
2013-01-23  3:08 ` [PATCH 10/25] mds: force journal straydn for rename if necessary Yan, Zheng
2013-01-23  3:08 ` [PATCH 11/25] mds: don't journal non-auth rename source directory Yan, Zheng
2013-01-23  3:08 ` [PATCH 12/25] mds: preserve non-auth/unlinked objects until slave commit Yan, Zheng
2013-01-23  3:08 ` [PATCH 13/25] mds: fix slave rename rollback Yan, Zheng
2013-01-23  3:08 ` [PATCH 14/25] mds: split reslove into two sub-stages Yan, Zheng
2013-01-23  3:08 ` [PATCH 15/25] mds: send resolve messages after all MDS reach resolve stage Yan, Zheng
2013-01-23  3:08 ` [PATCH 16/25] mds: Always use {push,pop}_projected_linkage to change linkage Yan, Zheng
2013-01-23  3:08 ` [PATCH 17/25] mds: don't replace existing slave request Yan, Zheng
2013-01-23  3:08 ` [PATCH 18/25] mds: fix for MDCache::adjust_bounded_subtree_auth Yan, Zheng
2013-01-23  3:08 ` [PATCH 19/25] mds: fix for MDCache::disambiguate_imports Yan, Zheng
2013-01-23  3:08 ` [PATCH 20/25] mds: journal inode's projected parent when doing link rollback Yan, Zheng
2013-01-23  3:08 ` [PATCH 21/25] mds: don't journal opened non-auth inode Yan, Zheng
2013-01-23  3:08 ` [PATCH 22/25] mds: properly clear CDir::STATE_COMPLETE when replaying EImportStart Yan, Zheng
2013-01-23  3:08 ` [PATCH 23/25] mds: move variables special to rename into MDRequest::more Yan, Zheng
2013-01-23  3:09 ` [PATCH 24/25] mds: rejoin remote wrlocks and frozen auth pin Yan, Zheng
2013-01-23  3:09 ` [PATCH 25/25] mds: fetch missing inodes from disk Yan, Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1358910541-15535-3-git-send-email-zheng.z.yan@intel.com \
    --to=zheng.z.yan@intel.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=sage@inktank.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.