From patchwork Fri Jul 29 05:38:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zefan X-Patchwork-Id: 1019032 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6T5cgtL022991 for ; Fri, 29 Jul 2011 05:38:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753615Ab1G2Fij (ORCPT ); Fri, 29 Jul 2011 01:38:39 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:57570 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1753436Ab1G2Fii (ORCPT ); Fri, 29 Jul 2011 01:38:38 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id BC32B17008E for ; Fri, 29 Jul 2011 13:38:35 +0800 (CST) Received: from mailserver.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id p6T5cYAX023322 for ; Fri, 29 Jul 2011 13:38:35 +0800 Received: from [10.167.225.230] ([10.167.225.230]) by mailserver.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.1FP4) with ESMTP id 2011072913373885-51470 ; Fri, 29 Jul 2011 13:37:38 +0800 Message-ID: <4E32475E.2080404@cn.fujitsu.com> Date: Fri, 29 Jul 2011 13:38:38 +0800 From: Li Zefan User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc14 Thunderbird/3.1.4 MIME-Version: 1.0 To: "linux-btrfs@vger.kernel.org" Subject: [PATCH] Btrfs: reverse enough space for file clone X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2011-07-29 13:37:38, Serialize by Router on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2011-07-29 13:37:39, Serialize complete at 2011-07-29 13:37:39 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.6 (demeter1.kernel.org [140.211.167.41]); Fri, 29 Jul 2011 05:38:42 +0000 (UTC) # mount -t btrfs /dev/sda7 /mnt # dd if=/dev/zero of=/mnt/src bs=10K count=1 # sync # clone 4K from /mnt/src to /mnt/dst kernel BUG at fs/btrfs/delayed-inode.c:1693! We should reverse space for both file extent item insertion and inode update. Signed-off-by: Li Zefan --- fs/btrfs/ioctl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 0b980af..05af14c 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -2314,7 +2314,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, else new_key.offset = destoff; - trans = btrfs_start_transaction(root, 1); + trans = btrfs_start_transaction(root, 2); if (IS_ERR(trans)) { ret = PTR_ERR(trans); goto out;