From patchwork Thu Nov 8 12:54:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 1715181 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 90356DF280 for ; Thu, 8 Nov 2012 12:54:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755503Ab2KHMyX (ORCPT ); Thu, 8 Nov 2012 07:54:23 -0500 Received: from mga14.intel.com ([143.182.124.37]:2159 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755497Ab2KHMyW (ORCPT ); Thu, 8 Nov 2012 07:54:22 -0500 Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga102.ch.intel.com with ESMTP; 08 Nov 2012 04:54:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,737,1344236400"; d="scan'208";a="165932703" Received: from unknown (HELO zyan5-mobl.ccr.corp.intel.com) ([10.255.21.122]) by AZSMGA002.ch.intel.com with ESMTP; 08 Nov 2012 04:54:17 -0800 From: "Yan, Zheng" To: sage@inktank.com, ceph-devel@vger.kernel.org Cc: "Yan, Zheng" Subject: [PATCH 1/2] mds: Don't expire log segment before it's fully flushed Date: Thu, 8 Nov 2012 20:54:14 +0800 Message-Id: <1352379255-5621-1-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.7.11.7 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/leveldb | 2 +- src/mds/MDLog.cc | 8 +++++--- 2 files changed, 6 insertions(+), 4 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);