From patchwork Mon Nov 19 02:43:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 1762091 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 510E43FCDE for ; Mon, 19 Nov 2012 02:43:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752846Ab2KSCny (ORCPT ); Sun, 18 Nov 2012 21:43:54 -0500 Received: from mga11.intel.com ([192.55.52.93]:27822 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752823Ab2KSCny (ORCPT ); Sun, 18 Nov 2012 21:43:54 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 18 Nov 2012 18:43:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.83,275,1352102400"; d="scan'208";a="251134060" Received: from zyan5-mobl.sh.intel.com ([10.239.36.18]) by fmsmga002.fm.intel.com with ESMTP; 18 Nov 2012 18:43:51 -0800 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org, sage@inktank.com Cc: "Yan, Zheng" Subject: [PATCH 01/16] mds: don't expire log segment before it's fully flushed Date: Mon, 19 Nov 2012 10:43:33 +0800 Message-Id: <1353293028-15238-2-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1353293028-15238-1-git-send-email-zheng.z.yan@intel.com> References: <1353293028-15238-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" Expiring log segment before it's fully flushed may cause various issues during log replay. Signed-off-by: Yan, Zheng --- src/mds/MDLog.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mds/MDLog.cc b/src/mds/MDLog.cc index cac5615..b02c181 100644 --- a/src/mds/MDLog.cc +++ b/src/mds/MDLog.cc @@ -330,6 +330,11 @@ void MDLog::trim(int m) assert(ls); p++; + if (ls->end > journaler->get_write_safe_pos()) { + dout(5) << "trim segment " << ls->offset << ", not fully flushed yet, safe " + << journaler->get_write_safe_pos() << " < end " << ls->end << dendl; + break; + } if (expiring_segments.count(ls)) { dout(5) << "trim already expiring segment " << ls->offset << ", " << ls->num_events << " events" << dendl; } else if (expired_segments.count(ls)) { @@ -412,9 +417,6 @@ void MDLog::_expired(LogSegment *ls) if (!capped && ls == get_current_segment()) { dout(5) << "_expired not expiring " << ls->offset << ", last one and !capped" << dendl; - } else if (ls->end > journaler->get_write_safe_pos()) { - dout(5) << "_expired not expiring " << ls->offset << ", not fully flushed yet, safe " - << journaler->get_write_safe_pos() << " < end " << ls->end << dendl; } else { // expired. expired_segments.insert(ls);