From patchwork Tue Dec 11 08:30:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 1861251 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 B3CCD3FCA5 for ; Tue, 11 Dec 2012 08:31:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752419Ab2LKIbJ (ORCPT ); Tue, 11 Dec 2012 03:31:09 -0500 Received: from mga11.intel.com ([192.55.52.93]:29584 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752435Ab2LKIbI (ORCPT ); Tue, 11 Dec 2012 03:31:08 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 11 Dec 2012 00:31:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,256,1355126400"; d="scan'208";a="262275429" Received: from zyan5-mobl.sh.intel.com ([10.239.36.25]) by fmsmga002.fm.intel.com with ESMTP; 11 Dec 2012 00:31:04 -0800 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org, sage@inktank.com Cc: "Yan, Zheng" Subject: [PATCH 01/14] mds: fix journaling issue regarding rstat accounting Date: Tue, 11 Dec 2012 16:30:47 +0800 Message-Id: <1355214660-26354-2-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" Rename operation can call predirty_journal_parents() several times. So a directory fragment's rstat can also be modified several times. But only the first modification is journaled because EMetaBlob::add_dir() does not update existing dirlump. For example: when hanlding 'mv a/b/c a/c', Server::_rename_prepare may first decrease directory a and b's nested files count by one, then increases directory a's nested files count by one. Signed-off-by: Yan, Zheng --- src/mds/events/EMetaBlob.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mds/events/EMetaBlob.h b/src/mds/events/EMetaBlob.h index 9c281e9..116b704 100644 --- a/src/mds/events/EMetaBlob.h +++ b/src/mds/events/EMetaBlob.h @@ -635,12 +635,12 @@ private: dirty, complete, isnew); } dirlump& add_dir(dirfrag_t df, fnode_t *pf, version_t pv, bool dirty, bool complete=false, bool isnew=false) { - if (lump_map.count(df) == 0) { + if (lump_map.count(df) == 0) lump_order.push_back(df); - lump_map[df].fnode = *pf; - lump_map[df].fnode.version = pv; - } + dirlump& l = lump_map[df]; + l.fnode = *pf; + l.fnode.version = pv; if (complete) l.mark_complete(); if (dirty) l.mark_dirty(); if (isnew) l.mark_new();