diff mbox

[1/2] mds: use "open-by-ino" helper to handle LOOKUPINO request

Message ID 1371796767-16205-1-git-send-email-zheng.z.yan@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yan, Zheng June 21, 2013, 6:39 a.m. UTC
From: "Yan, Zheng" <zheng.z.yan@intel.com>

Fixes #3541
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
---
 src/mds/Server.cc | 38 ++++++++------------------------------
 src/mds/Server.h  |  1 -
 2 files changed, 8 insertions(+), 31 deletions(-)

Comments

Sage Weil June 22, 2013, 12:38 a.m. UTC | #1
Applied both of these, and merged in your wip-mds branch.

This is great!  NFS reexport from a kernel cephfs mount should now be 
reliable (no more ESTALE errors).

sage

On Fri, 21 Jun 2013, Yan, Zheng wrote:

> From: "Yan, Zheng" <zheng.z.yan@intel.com>
> 
> Fixes #3541
> Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
> ---
>  src/mds/Server.cc | 38 ++++++++------------------------------
>  src/mds/Server.h  |  1 -
>  2 files changed, 8 insertions(+), 31 deletions(-)
> 
> diff --git a/src/mds/Server.cc b/src/mds/Server.cc
> index 1d16d04..e84626b 100644
> --- a/src/mds/Server.cc
> +++ b/src/mds/Server.cc
> @@ -2483,41 +2483,19 @@ void Server::handle_client_lookup_ino(MDRequest *mdr)
>  void Server::_lookup_ino(MDRequest *mdr)
>  {
>    inodeno_t ino = mdr->client_request->get_filepath().get_ino();
> -  dout(10) << "_lookup_ino " << mdr << " checking peers for ino " << ino << dendl;
> -  mdcache->find_ino_peers(ino,
> -			  new C_MDS_LookupIno2(this, mdr), -1);
> +  dout(10) << "_lookup_ino " << mdr << " opening ino " << ino << dendl;
> +  mdcache->open_ino(ino, (int64_t)-1, new C_MDS_LookupIno2(this, mdr), false);
>  }
>  
> -struct C_MDS_LookupIno3 : public Context {
> -  Server *server;
> -  MDRequest *mdr;
> -  C_MDS_LookupIno3(Server *s, MDRequest *r) : server(s), mdr(r) {}
> -  void finish(int r) {
> -    server->_lookup_ino_3(mdr, r);
> -  }
> -};
> -
>  void Server::_lookup_ino_2(MDRequest *mdr, int r)
>  {
>    inodeno_t ino = mdr->client_request->get_filepath().get_ino();
> -  dout(10) << "_lookup_ino_2 " << mdr << " checked peers for ino " << ino
> -	   << " and got r=" << r << dendl;
> -  if (r == 0) {
> -    dispatch_client_request(mdr);
> -    return;
> -  }
> -
> -  // okay fine, maybe it's a directory though...
> -  mdcache->find_ino_dir(ino, new C_MDS_LookupIno3(this, mdr));
> -}
> -
> -void Server::_lookup_ino_3(MDRequest *mdr, int r)
> -{
> -  inodeno_t ino = mdr->client_request->get_filepath().get_ino();
> -  dout(10) << "_lookup_ino_3 " << mdr << " checked dir obj for ino " << ino
> -	   << " and got r=" << r << dendl;
> -  if (r == 0) {
> -    dispatch_client_request(mdr);
> +  dout(10) << "_lookup_ino_2 " << mdr << " ino " << ino << " r=" << r << dendl;
> +  if (r >= 0) {
> +    if (r == mds->get_nodeid())
> +      dispatch_client_request(mdr);
> +    else
> +      mdcache->request_forward(mdr, r);
>      return;
>    }
>  
> diff --git a/src/mds/Server.h b/src/mds/Server.h
> index 269b286..2da4055 100644
> --- a/src/mds/Server.h
> +++ b/src/mds/Server.h
> @@ -146,7 +146,6 @@ public:
>    void handle_client_lookup_ino(MDRequest *mdr);
>    void _lookup_ino(MDRequest *mdr);
>    void _lookup_ino_2(MDRequest *mdr, int r);
> -  void _lookup_ino_3(MDRequest *mdr, int r);
>    void handle_client_readdir(MDRequest *mdr);
>    void handle_client_file_setlock(MDRequest *mdr);
>    void handle_client_file_readlock(MDRequest *mdr);
> -- 
> 1.8.1.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/mds/Server.cc b/src/mds/Server.cc
index 1d16d04..e84626b 100644
--- a/src/mds/Server.cc
+++ b/src/mds/Server.cc
@@ -2483,41 +2483,19 @@  void Server::handle_client_lookup_ino(MDRequest *mdr)
 void Server::_lookup_ino(MDRequest *mdr)
 {
   inodeno_t ino = mdr->client_request->get_filepath().get_ino();
-  dout(10) << "_lookup_ino " << mdr << " checking peers for ino " << ino << dendl;
-  mdcache->find_ino_peers(ino,
-			  new C_MDS_LookupIno2(this, mdr), -1);
+  dout(10) << "_lookup_ino " << mdr << " opening ino " << ino << dendl;
+  mdcache->open_ino(ino, (int64_t)-1, new C_MDS_LookupIno2(this, mdr), false);
 }
 
-struct C_MDS_LookupIno3 : public Context {
-  Server *server;
-  MDRequest *mdr;
-  C_MDS_LookupIno3(Server *s, MDRequest *r) : server(s), mdr(r) {}
-  void finish(int r) {
-    server->_lookup_ino_3(mdr, r);
-  }
-};
-
 void Server::_lookup_ino_2(MDRequest *mdr, int r)
 {
   inodeno_t ino = mdr->client_request->get_filepath().get_ino();
-  dout(10) << "_lookup_ino_2 " << mdr << " checked peers for ino " << ino
-	   << " and got r=" << r << dendl;
-  if (r == 0) {
-    dispatch_client_request(mdr);
-    return;
-  }
-
-  // okay fine, maybe it's a directory though...
-  mdcache->find_ino_dir(ino, new C_MDS_LookupIno3(this, mdr));
-}
-
-void Server::_lookup_ino_3(MDRequest *mdr, int r)
-{
-  inodeno_t ino = mdr->client_request->get_filepath().get_ino();
-  dout(10) << "_lookup_ino_3 " << mdr << " checked dir obj for ino " << ino
-	   << " and got r=" << r << dendl;
-  if (r == 0) {
-    dispatch_client_request(mdr);
+  dout(10) << "_lookup_ino_2 " << mdr << " ino " << ino << " r=" << r << dendl;
+  if (r >= 0) {
+    if (r == mds->get_nodeid())
+      dispatch_client_request(mdr);
+    else
+      mdcache->request_forward(mdr, r);
     return;
   }
 
diff --git a/src/mds/Server.h b/src/mds/Server.h
index 269b286..2da4055 100644
--- a/src/mds/Server.h
+++ b/src/mds/Server.h
@@ -146,7 +146,6 @@  public:
   void handle_client_lookup_ino(MDRequest *mdr);
   void _lookup_ino(MDRequest *mdr);
   void _lookup_ino_2(MDRequest *mdr, int r);
-  void _lookup_ino_3(MDRequest *mdr, int r);
   void handle_client_readdir(MDRequest *mdr);
   void handle_client_file_setlock(MDRequest *mdr);
   void handle_client_file_readlock(MDRequest *mdr);