From patchwork Mon Feb 1 02:41:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 76021 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o112hTP2029995 for ; Mon, 1 Feb 2010 02:43:29 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751397Ab0BACn1 (ORCPT ); Sun, 31 Jan 2010 21:43:27 -0500 Received: from acsinet12.oracle.com ([141.146.126.234]:43659 "EHLO acsinet12.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750909Ab0BACn1 (ORCPT ); Sun, 31 Jan 2010 21:43:27 -0500 Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by acsinet12.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o112hPjb002099 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 1 Feb 2010 02:43:26 GMT Received: from acsmt354.oracle.com (acsmt354.oracle.com [141.146.40.154]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o112hKwk027975 for ; Mon, 1 Feb 2010 02:43:24 GMT Received: from abhmt017.oracle.com by acsmt353.oracle.com with ESMTP id 2782581264992084; Sun, 31 Jan 2010 18:41:24 -0800 Received: from [10.182.121.20] (/10.182.121.20) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 31 Jan 2010 18:41:24 -0800 Message-ID: <4B663F4D.8090007@oracle.com> Date: Mon, 01 Feb 2010 10:41:17 +0800 From: "Yan, Zheng" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.7) Gecko/20100120 Fedora/3.0.1-1.fc12 Thunderbird/3.0.1 MIME-Version: 1.0 To: linux-btrfs@vger.kernel.org, chris Mason Subject: [PATCH] btrfs: Fix oopsen when dropping empty tree. X-Source-IP: acsmt354.oracle.com [141.146.40.154] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090209.4B663FCD.000F:SCFMA4539814,ss=1,fgs=0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 01 Feb 2010 02:43:29 +0000 (UTC) diff -urp 1/fs/btrfs/extent-tree.c 2/fs/btrfs/extent-tree.c --- 1/fs/btrfs/extent-tree.c 2010-01-22 12:16:34.203525744 +0800 +++ 2/fs/btrfs/extent-tree.c 2010-02-01 10:26:19.865562007 +0800 @@ -5402,10 +5402,6 @@ static noinline int walk_down_tree(struc int ret; while (level >= 0) { - if (path->slots[level] >= - btrfs_header_nritems(path->nodes[level])) - break; - ret = walk_down_proc(trans, root, path, wc, lookup_info); if (ret > 0) break; @@ -5413,6 +5409,10 @@ static noinline int walk_down_tree(struc if (level == 0) break; + if (path->slots[level] >= + btrfs_header_nritems(path->nodes[level])) + break; + ret = do_walk_down(trans, root, path, wc, &lookup_info); if (ret > 0) { path->slots[level]++;