From patchwork Tue Oct 2 08:55:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 1536421 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 6BB73DF238 for ; Tue, 2 Oct 2012 08:56:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754843Ab2JBI4I (ORCPT ); Tue, 2 Oct 2012 04:56:08 -0400 Received: from mga03.intel.com ([143.182.124.21]:51424 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754782Ab2JBI4H (ORCPT ); Tue, 2 Oct 2012 04:56:07 -0400 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 02 Oct 2012 01:56:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,522,1344236400"; d="scan'208";a="199527992" Received: from unknown (HELO zyan5-mobl.ccr.corp.intel.com) ([10.255.21.40]) by azsmga001.ch.intel.com with ESMTP; 02 Oct 2012 01:56:05 -0700 From: "Yan, Zheng" To: sage@inktank.com, ceph-devel@vger.kernel.org Cc: "Yan, Zheng" Subject: [PATCH 04/12] mds: Allow rename request for stray migration/reintegration Date: Tue, 2 Oct 2012 16:55:44 +0800 Message-Id: <1349168152-13281-4-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1349168152-13281-1-git-send-email-zheng.z.yan@intel.com> References: <1349168152-13281-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" Allow rename request to modify system directory if it is for stray migration/reintegration. Signed-off-by: Yan, Zheng --- src/mds/Server.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 4c52ca2..8584e60 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -1983,7 +1983,7 @@ CDentry* Server::rdlock_path_xlock_dentry(MDRequest *mdr, int n, } CInode *diri = dir->get_inode(); - if (diri->is_system() && !diri->is_root()) { + if (!mdr->reqid.name.is_mds() && diri->is_system() && !diri->is_root()) { reply_request(mdr, -EROFS); return 0; } @@ -5126,10 +5126,12 @@ void Server::handle_client_rename(MDRequest *mdr) pdn = pdn->get_dir()->inode->parent; } - // is this a stray reintegration or merge? (sanity checks!) + // is this a stray migration, reintegration or merge? (sanity checks!) if (mdr->reqid.name.is_mds() && - (!destdnl->is_remote() || - destdnl->get_remote_ino() != srci->ino())) { + !(MDS_INO_IS_STRAY(srcpath.get_ino()) && + MDS_INO_IS_STRAY(destpath.get_ino())) && + !(destdnl->is_remote() && + destdnl->get_remote_ino() == srci->ino())) { reply_request(mdr, -EINVAL); // actually, this won't reply, but whatev. return; }