From patchwork Tue Dec 11 08:30:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 1861261 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 5D62B3FCA5 for ; Tue, 11 Dec 2012 08:31:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752591Ab2LKIb0 (ORCPT ); Tue, 11 Dec 2012 03:31:26 -0500 Received: from mga11.intel.com ([192.55.52.93]:65284 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751821Ab2LKIbJ (ORCPT ); Tue, 11 Dec 2012 03:31:09 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 11 Dec 2012 00:31:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,256,1355126400"; d="scan'208";a="262275455" Received: from zyan5-mobl.sh.intel.com ([10.239.36.25]) by fmsmga002.fm.intel.com with ESMTP; 11 Dec 2012 00:31:08 -0800 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org, sage@inktank.com Cc: "Yan, Zheng" Subject: [PATCH 05/14] mds: set want_base_dir to false for MDCache::discover_ino() Date: Tue, 11 Dec 2012 16:30:51 +0800 Message-Id: <1355214660-26354-6-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1355214660-26354-1-git-send-email-zheng.z.yan@intel.com> References: <1355214660-26354-1-git-send-email-zheng.z.yan@intel.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org From: "Yan, Zheng" When frozen inode is encountered, MDCache::handle_discover() sends reply immediately if the reply message is not empty. When handling "discover ino" requests, the reply message always contains the base directory fragment. But requestor already has the base directory fragment, the only effect of the reply message is wake the requestor and make it send same "discover ino" request again. So the requestor keeps sending "discover ino" requests but can't make any progress. The fix is set want_base_dir to false for MDCache::discover_ino(). After set want_base_dir to false, also need update the code that handles "discover ino" error. This patch also remove unused error handling code for flag_error_dn Signed-off-by: Yan, Zheng --- src/mds/MDCache.cc | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 7733d0d..893b651 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -8547,7 +8547,7 @@ void MDCache::discover_ino(CDir *base, d.ino = base->ino(); d.frag = base->get_frag(); d.want_ino = want_ino; - d.want_base_dir = true; + d.want_base_dir = false; d.want_xlocked = want_xlocked; _send_discover(d); } @@ -8890,6 +8890,18 @@ void MDCache::handle_discover_reply(MDiscoverReply *m) } } + // discover ino error + if (p.end() && m->is_flag_error_ino()) { + assert(cur->is_dir()); + CDir *dir = cur->get_dirfrag(m->get_base_dir_frag()); + if (dir) { + dout(7) << " flag_error on ino " << m->get_wanted_ino() + << ", triggering ino" << dendl; + dir->take_ino_waiting(m->get_wanted_ino(), error); + } else + assert(0); + } + // discover may start with an inode if (!p.end() && next == MDiscoverReply::INODE) { cur = add_replica_inode(p, NULL, finished); @@ -8925,30 +8937,6 @@ void MDCache::handle_discover_reply(MDiscoverReply *m) curdir = cur->get_dirfrag(m->get_base_dir_frag()); } - // dentry error? - if (p.end() && (m->is_flag_error_dn() || m->is_flag_error_ino())) { - // error! - assert(cur->is_dir()); - if (curdir) { - if (m->get_error_dentry().length()) { - dout(7) << " flag_error on dentry " << m->get_error_dentry() - << ", triggering dentry" << dendl; - curdir->take_dentry_waiting(m->get_error_dentry(), - m->get_wanted_snapid(), m->get_wanted_snapid(), error); - } else { - dout(7) << " flag_error on ino " << m->get_wanted_ino() - << ", triggering ino" << dendl; - curdir->take_ino_waiting(m->get_wanted_ino(), error); - } - } else { - dout(7) << " flag_error on dentry " << m->get_error_dentry() - << ", triggering dir?" << dendl; - cur->take_waiting(CInode::WAIT_DIR, error); - } - break; - } - assert(curdir); - if (p.end()) break;