From patchwork Mon Aug 27 16:23:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1377811 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 18B36DF280 for ; Mon, 27 Aug 2012 16:23:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752222Ab2H0QXY (ORCPT ); Mon, 27 Aug 2012 12:23:24 -0400 Received: from lsd-gw.ic.unicamp.br ([143.106.7.165]:41032 "EHLO boneca.lsd.ic.unicamp.br" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751063Ab2H0QXX convert rfc822-to-8bit (ORCPT ); Mon, 27 Aug 2012 12:23:23 -0400 Received: from freie (gw-to-emilia.oliva.athome.lsd.ic.unicamp.br [172.31.160.17] (may be forged)) by boneca.lsd.ic.unicamp.br (8.14.5/8.14.5) with ESMTP id q7RGNB2l029777; Mon, 27 Aug 2012 13:23:11 -0300 Received: from livre.localdomain (livre-to-gw.oliva.athome.lsd.ic.unicamp.br [172.31.160.19]) by freie (8.14.5/8.14.5) with ESMTP id q7RGNAFv007041; Mon, 27 Aug 2012 13:23:10 -0300 Received: from livre.localdomain (aoliva@localhost.localdomain [127.0.0.1]) by livre.localdomain (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id q7RGN9h8008783; Mon, 27 Aug 2012 13:23:09 -0300 Received: (from aoliva@localhost) by livre.localdomain (8.14.3/8.14.3/Submit) id q7RGN8j8008781; Mon, 27 Aug 2012 13:23:08 -0300 X-Authentication-Warning: livre.localdomain: aoliva set sender to oliva@lsd.ic.unicamp.br using -f From: Alexandre Oliva To: Sage Weil Cc: Sage Weil , ceph-devel@vger.kernel.org Subject: Re: [PATCH] Add old_inodes to emetablob Organization: Free thinker, not speaking for University of Campinas References: Date: Mon, 27 Aug 2012 13:23:07 -0300 In-Reply-To: (Sage Weil's message of "Sun, 19 Aug 2012 14:22:24 -0700 (PDT)") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org On Aug 19, 2012, Sage Weil wrote: > This might do the trick? > diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc > in->old_inodes.swap(old_inodes); > + if (!in->old_inodes.empty()) > + in->first = in->old_inodes.rbegin()->first + 1; > if (snaps) At first, it didn't. I had to install/keep a few additional patches to avoid “corruption” of old snapshots. Later on, I guess all “first” fields in the journal were corrected, and then I didn't get the warnings added by my patches any more. So it may be that your patch is enough, after all, but this is the patchset I've used over the past week, with a very little bit of snapshot creation. Unfortunately, modifying snapshotted directories, particularly mass removal of subtrees, is still triggering some serious issues in the mds (crashes, infinite loops, unrecoverable clusters, all sorts of fun stuff :-), but I'm yet to look into that. mds: update cached first along with old_inodes When fetching a directory, make sure first is greater than the fetched old_inodes. Signed-off-by: Alexandre Oliva Suggested-by: Sage Weil --- src/mds/CDir.cc | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc index 6761c6f..71ef03a 100644 --- a/src/mds/CDir.cc +++ b/src/mds/CDir.cc @@ -1564,6 +1564,11 @@ void CDir::_fetched(bufferlist &bl, const string& want_dn) in->xattrs.swap(xattrs); in->decode_snap_blob(snapbl); in->old_inodes.swap(old_inodes); + if (!in->old_inodes.empty()) { + snapid_t newfirst = in->old_inodes.rbegin()->first + 1; + if (newfirst > in->first) + in->first = newfirst; + } if (snaps) in->purge_stale_snap_data(*snaps); -- 1.7.7.6 mds: Don't modify already-created old_inode In cow_old_inode, do not modify an old_inode that was created before. Signed-off-by: Alexandre Oliva --- src/mds/CInode.cc | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index 53f9e69..d17fd26 100644 --- a/src/mds/CInode.cc +++ b/src/mds/CInode.cc @@ -2030,12 +2030,18 @@ old_inode_t& CInode::cow_old_inode(snapid_t follows, bool cow_head) inode_t *pi = cow_head ? get_projected_inode() : get_previous_projected_inode(); map *px = cow_head ? get_projected_xattrs() : get_previous_projected_xattrs(); + bool found = old_inodes.find(follows) != old_inodes.end(); old_inode_t &old = old_inodes[follows]; - old.first = first; - old.inode = *pi; - old.xattrs = *px; - - dout(10) << " " << px->size() << " xattrs cowed, " << *px << dendl; + + if (!found) { + old.first = first; + old.inode = *pi; + old.xattrs = *px; + + dout(10) << " " << px->size() << " xattrs cowed, " << *px << dendl; + } else + dout(0) << "cow_old_inode not modifying existing old_inode " << first + << " for " << follows << " on " << *this << dendl; old.inode.trim_client_ranges(follows); -- 1.7.7.6 mds: warn when first is lower than latest old_inode Warn in cow_old_inode if first is out of date WRT old_inodes. Signed-off-by: Alexandre Oliva --- src/mds/CInode.cc | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index d17fd26..f1be8e4 100644 --- a/src/mds/CInode.cc +++ b/src/mds/CInode.cc @@ -2027,6 +2027,11 @@ old_inode_t& CInode::cow_old_inode(snapid_t follows, bool cow_head) { assert(follows >= first); + if (!old_inodes.empty() && first <= old_inodes.rbegin()->first) { + dout(0) << "cow_old_inode " << " first " << first << " but already had " + << old_inodes.rbegin()->first << " on " << *this << dendl; + } + inode_t *pi = cow_head ? get_projected_inode() : get_previous_projected_inode(); map *px = cow_head ? get_projected_xattrs() : get_previous_projected_xattrs();