From patchwork Mon Sep 24 11:44:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Monakhov X-Patchwork-Id: 186384 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id C5B4E2C0086 for ; Mon, 24 Sep 2012 21:44:50 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754184Ab2IXLos (ORCPT ); Mon, 24 Sep 2012 07:44:48 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:61353 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754695Ab2IXLoq (ORCPT ); Mon, 24 Sep 2012 07:44:46 -0400 Received: by lbbgj3 with SMTP id gj3so6549720lbb.19 for ; Mon, 24 Sep 2012 04:44:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=wBszH5KA64YE5tL+Z65gv82hLVR+hzLJ/KZqnj1dvb4=; b=ag1VhxgtGOEVja3KbCRgitjaPn/58F8FqaTiINS/BM81yzBRdL73Kyr2cCgZnovFwQ dA0MG1JCogPCdBPh0z+KVaYzk+Xn7g1Wr4ElakJL33sRCqENY739e/+E/3jPAshpEiXN dxSFTPoVSnDAjH367KA1wN1hVAvcERVWwOPlodHHNwNIMXwz+D63QZ6uQyWPhREFA7BU UiayH9qBJjFxIxw03x8bnF5nz+MvmXg6LGFVL10iFuiqkG8HkYNr1/DNTvdzb0Eaz2j+ Nb2ajmsKHGN9XuZ2be+n1YoZcBLyL9ic6AgzIva6bqBwpf8vN+3Ip6J1Bfb5SKv3ChL7 8Qaw== Received: by 10.112.23.36 with SMTP id j4mr4269109lbf.71.1348487084762; Mon, 24 Sep 2012 04:44:44 -0700 (PDT) Received: from smtp.gmail.com (swsoft-msk-nat.sw.ru. [195.214.232.10]) by mx.google.com with ESMTPS id gd18sm4273923lab.1.2012.09.24.04.44.43 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 24 Sep 2012 04:44:44 -0700 (PDT) From: Dmitry Monakhov To: linux-ext4@vger.kernel.org Cc: tytso@mit.edu, jack@suse.cz, lczerner@redhat.com, Dmitry Monakhov Subject: [PATCH 10/10] ext4: fix ext_remove_space for punch_hole case Date: Mon, 24 Sep 2012 15:44:20 +0400 Message-Id: <1348487060-19598-11-git-send-email-dmonakhov@openvz.org> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1348487060-19598-1-git-send-email-dmonakhov@openvz.org> References: <1348487060-19598-1-git-send-email-dmonakhov@openvz.org> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Inode is allowed to have empty leaf only if it this is blockless inode i.e. (depth == 0). Signed-off-by: Dmitry Monakhov --- fs/ext4/extents.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 2d58f4c..57d6438 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -2648,12 +2648,15 @@ again: return PTR_ERR(path); } depth = ext_depth(inode); + /* Leaf not may not exist only if inode has no blocks at all */ ex = path[depth].p_ext; if (!ex) { - ext4_ext_drop_refs(path); - kfree(path); - path = NULL; - goto cont; + if (depth) { + EXT4_ERROR_INODE(inode, "path[%d].p_hdr == NULL", + depth); + err = -EIO; + } + goto out; } ee_block = le32_to_cpu(ex->ee_block);