)]}'
{
  "commit": "199c36eaa95077a47ae1bc55532fc0fbeb80cc95",
  "tree": "ef4e9a5ff244c842b9b335cb391223d9a4d5f854",
  "parents": [
    "f7aaa06bff6f5fe049ce9723267e1639c2c3d8b5"
  ],
  "author": {
    "name": "Miao Xie",
    "email": "miaox@cn.fujitsu.com",
    "time": "Fri Jul 15 10:34:36 2011 +0000"
  },
  "committer": {
    "name": "Chris Mason",
    "email": "chris.mason@oracle.com",
    "time": "Wed Jul 27 12:46:45 2011 -0400"
  },
  "message": "Btrfs: fix BUG_ON() caused by ENOSPC when relocating space\n\nWhen we balanced the chunks across the devices, BUG_ON() in\n__finish_chunk_alloc() was triggered.\n\n------------[ cut here ]------------\nkernel BUG at fs/btrfs/volumes.c:2568!\n[SNIP]\nCall Trace:\n [\u003cffffffffa049525e\u003e] btrfs_alloc_chunk+0x8e/0xa0 [btrfs]\n [\u003cffffffffa04546b0\u003e] do_chunk_alloc+0x330/0x3a0 [btrfs]\n [\u003cffffffffa045c654\u003e] btrfs_reserve_extent+0xb4/0x1f0 [btrfs]\n [\u003cffffffffa045c86b\u003e] btrfs_alloc_free_block+0xdb/0x350 [btrfs]\n [\u003cffffffffa048a8d8\u003e] ? read_extent_buffer+0xd8/0x1d0 [btrfs]\n [\u003cffffffffa04476fd\u003e] __btrfs_cow_block+0x14d/0x5e0 [btrfs]\n [\u003cffffffffa044660d\u003e] ? read_block_for_search+0x14d/0x4d0 [btrfs]\n [\u003cffffffffa0447c9b\u003e] btrfs_cow_block+0x10b/0x240 [btrfs]\n [\u003cffffffffa044dd5e\u003e] btrfs_search_slot+0x49e/0x7a0 [btrfs]\n [\u003cffffffffa044f07d\u003e] btrfs_insert_empty_items+0x8d/0xf0 [btrfs]\n [\u003cffffffffa045e973\u003e] insert_with_overflow+0x43/0x110 [btrfs]\n [\u003cffffffffa045eb0d\u003e] btrfs_insert_dir_item+0xcd/0x1f0 [btrfs]\n [\u003cffffffffa0489bd0\u003e] ? map_extent_buffer+0xb0/0xc0 [btrfs]\n [\u003cffffffff812276ad\u003e] ? rb_insert_color+0x9d/0x160\n [\u003cffffffffa046cc40\u003e] ? inode_tree_add+0xf0/0x150 [btrfs]\n [\u003cffffffffa0474801\u003e] btrfs_add_link+0xc1/0x1c0 [btrfs]\n [\u003cffffffff811dacac\u003e] ? security_inode_init_security+0x1c/0x30\n [\u003cffffffffa04a28aa\u003e] ? btrfs_init_acl+0x4a/0x180 [btrfs]\n [\u003cffffffffa047492f\u003e] btrfs_add_nondir+0x2f/0x70 [btrfs]\n [\u003cffffffffa046af16\u003e] ? btrfs_init_inode_security+0x46/0x60 [btrfs]\n [\u003cffffffffa0474ac0\u003e] btrfs_create+0x150/0x1d0 [btrfs]\n [\u003cffffffff81159c63\u003e] ? generic_permission+0x23/0xb0\n [\u003cffffffff8115b415\u003e] vfs_create+0xa5/0xc0\n [\u003cffffffff8115ce6e\u003e] do_last+0x5fe/0x880\n [\u003cffffffff8115dc0d\u003e] path_openat+0xcd/0x3d0\n [\u003cffffffff8115e029\u003e] do_filp_open+0x49/0xa0\n [\u003cffffffff8116a965\u003e] ? alloc_fd+0x95/0x160\n [\u003cffffffff8114f0c7\u003e] do_sys_open+0x107/0x1e0\n [\u003cffffffff810bcc3f\u003e] ? audit_syscall_entry+0x1bf/0x1f0\n [\u003cffffffff8114f1e0\u003e] sys_open+0x20/0x30\n [\u003cffffffff81484ec2\u003e] system_call_fastpath+0x16/0x1b\n[SNIP]\nRIP  [\u003cffffffffa049444a\u003e] __finish_chunk_alloc+0x20a/0x220 [btrfs]\n\nThe reason is:\nTask1\t\t\t\t\tSpace balance task\ndo_chunk_alloc()\n  __finish_chunk_alloc()\n    update device info\n    in the chunk tree\n      alloc system metadata block\n\t\t\t\t\trelocate system metadata block group\n\t\t\t\t\t  set system metadata block group\n\t\t\t\t\t  readonly, This block group is the\n\t\t\t\t\t  only one that can allocate space. So\n\t\t\t\t\t  there is no free space that can be\n\t\t\t\t\t  allocated now.\n        find no space and don\u0027t try\n        to alloc new chunk, and then\n        return ENOSPC\n  BUG_ON() in __finish_chunk_alloc()\n  was triggered.\n\nFix this bug by allocating a new system metadata chunk before relocating the\nold one if we find there is no free space which can be allocated after setting\nthe old block group to be read-only.\n\nReported-by: Tsutomu Itoh \u003ct-itoh@jp.fujitsu.com\u003e\nSigned-off-by: Miao Xie \u003cmiaox@cn.fujitsu.com\u003e\nTested-by: Tsutomu Itoh \u003ct-itoh@jp.fujitsu.com\u003e\nSigned-off-by: Chris Mason \u003cchris.mason@oracle.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "d7031e7dfd76ace7414dbaaa1e190f53f4b503ae",
      "old_mode": 33188,
      "old_path": "fs/btrfs/extent-tree.c",
      "new_id": "7021dde74d81890c8a717260c1a9a1ca1b92f9c5",
      "new_mode": 33188,
      "new_path": "fs/btrfs/extent-tree.c"
    }
  ]
}
