From patchwork Tue Feb 19 18:44:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 2163971 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 D6CB7DFE86 for ; Tue, 19 Feb 2013 18:44:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933466Ab3BSSon (ORCPT ); Tue, 19 Feb 2013 13:44:43 -0500 Received: from linux-libre.fsfla.org ([208.118.235.54]:35472 "EHLO linux-libre.fsfla.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933292Ab3BSSom (ORCPT ); Tue, 19 Feb 2013 13:44:42 -0500 Received: from freie (home.lxoliva.fsfla.org [172.31.160.22]) by linux-libre.fsfla.org (8.14.3/8.14.3/Debian-9.1ubuntu1) with ESMTP id r1JIidea009603 for ; Tue, 19 Feb 2013 18:44:40 GMT Received: from livre.home (livre.home [172.31.160.2]) by freie (8.14.6/8.14.6) with ESMTP id r1JIiMdk004845; Tue, 19 Feb 2013 15:44:23 -0300 From: Alexandre Oliva To: ceph-devel@vger.kernel.org Subject: [bug #1435] fix loss of dir layout info on mds restart Organization: Free thinker, not speaking for the GNU Project Date: Tue, 19 Feb 2013 15:44:20 -0300 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (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 Here's a fix for bug 1435. The MDS didn't recover default_layout for subdirs from dir entries encoded in the parent dir, so layout policies could be lost upon MDS restart if they didn't happen to be encoded in some other change still present in the MDS journal. Fix restoring dir layouts from dir entries From: Alexandre Oliva Signed-off-by: Alexandre Oliva --- src/mds/CDir.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc index 4b1d3ef..e5a147d 100644 --- a/src/mds/CDir.cc +++ b/src/mds/CDir.cc @@ -1566,6 +1566,16 @@ void CDir::_fetched(bufferlist &bl, const string& want_dn) // symlink? if (in->is_symlink()) in->symlink = symlink; + else if (in->is_dir()) { + default_file_layout dfl; + memset(&dfl, 0, sizeof(dfl)); + // FIXME: this should be properly encoded + if (memcmp (&dfl.layout, &in->inode.layout, sizeof(dfl)) != 0) { + in->default_layout = new default_file_layout; + memcpy (&in->default_layout->layout, + &in->inode.layout, sizeof(dfl)); + } + } in->dirfragtree.swap(fragtree); in->xattrs.swap(xattrs);