naota / linux

Linux kernel source tree
Other
3 stars 1 forks source link

ASSERTion in remove_free_space_extent() #61

Closed morbidrsa closed 2 years ago

morbidrsa commented 2 years ago

When running fstetsts' generic/068 on zoned null_blk devices, with zone-size 128M, zone-capacity 64M and a max-active-zones value of 14 triggers the following ASSERT() in remove_free_space_extent():


    found_start = key.objectid;
    found_end = key.objectid + key.offset;
    ASSERT(start >= found_start && end <= found_end);

Here's a preliminary analysis with gdb in the moment the ASSERT() has triggered.

[johannes@redsun91:linux (btrfs-misc-next)]$ gdb vmlinux 
GNU gdb (GDB) Fedora 11.1-6.fc35
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from vmlinux...
(gdb) target remote localhost:1234
Remote debugging using localhost:1234
warning: Remote gdbserver does not support determining executable automatically.
RHEL <=6.8 and <=7.2 versions of gdbserver do not support such automatic executable detection.
The following versions of gdbserver support it:
- Upstream version of gdbserver (unsupported) 7.10 or later
- Red Hat Developer Toolset (DTS) version of gdbserver from DTS 4.0 or later (only on x86_64)
- RHEL-7.3 versions of gdbserver (on any architecture)
amd_e400_idle () at arch/x86/kernel/process.c:796
796                     return;
(gdb) lx-symbols 
loading vmlinux
scanning for modules in /home/johannes/src/linux
loading @0xffffffffa00cc000: /home/johannes/src/linux/fs/btrfs/btrfs.ko
loading @0xffffffffa00c3000: /home/johannes/src/linux/crypto/blake2b_generic.ko
loading @0xffffffffa00b8000: /home/johannes/src/linux/crypto/xor.ko
loading @0xffffffffa00b1000: /home/johannes/src/linux/lib/lzo/lzo_compress.ko
loading @0xffffffffa00a7000: /home/johannes/src/linux/lib/zlib_deflate/zlib_deflate.ko
loading @0xffffffffa0085000: /home/johannes/src/linux/lib/raid6/raid6_pq.ko
loading @0xffffffffa0063000: /home/johannes/src/linux/lib/zstd/zstd_decompress.ko
loading @0xffffffffa0014000: /home/johannes/src/linux/lib/zstd/zstd_compress.ko
loading @0xffffffffa000d000: /home/johannes/src/linux/lib/xxhash.ko
loading @0xffffffffa0000000: /home/johannes/src/linux/drivers/block/null_blk/null_blk.ko
(gdb) break fs/btrfs/free-space-tree.c:737 if !(start >= found_start && end <= found_end)
Breakpoint 1 at 0xffffffffa0176086: file fs/btrfs/free-space-tree.c, line 737.
(gdb) c
Continuing.
[Switching to Thread 1.2]

Thread 2 hit Breakpoint 1, remove_free_space_extent (size=1407963136, start=1407971328, path=0xffff88811318c5b0, block_group=0xffff88810d3c1000, trans=0xffff888100472a28) at fs/btrfs/free-space-tree.c:737
737             ASSERT(start >= found_start && end <= found_end);
(gdb) p start
$1 = 1407971328
(gdb) p found_start
$2 = 1407963136
(gdb) p end
$3 = 1407995904
(gdb) p found_end
$4 = 1407967232
(gdb) p size
$5 = 1407963136
(gdb) p key
$6 = {
  objectid = 1407963136,
  type = 199 '\307',
  offset = 4096
}
(gdb) p *path
$7 = {
  nodes = {0xffff888113e75770, 0x0 <fixed_percpu_data>, 0x0 <fixed_percpu_data>, 0x0 <fixed_percpu_data>, 0x0 <fixed_percpu_data>, 0x0 <fixed_percpu_data>, 0x0 <fixed_percpu_data>, 0x0 <fixed_percpu_data>},
  slots = {106, 0, 0, 0, 0, 0, 0, 0},
  locks = "\001\000\000\000\000\000\000",
  reada = 0 '\000',
  lowest_level = 0 '\000',
  search_for_split = 0,
  keep_locks = 0,
  skip_locking = 0,
  search_commit_root = 0,
  need_commit_sem = 0,
  skip_release_on_error = 0,
  search_for_extension = 0
}
(gdb) p *path->nodes[0]
$8 = {
  start = 2561048576,
  len = 16384,
  bflags = 531,
  fs_info = 0xffff88810d42d000,
  refs_lock = {
    {
      rlock = {
        raw_lock = {
          {
            val = {
              counter = 0
            },
            {
              locked = 0 '\000',
              pending = 0 '\000'
            },
            {
              locked_pending = 0,
              tail = 0
            }
          }
        }
      }
    }
  },
  refs = {
    counter = 3
  },
  io_pages = {
    counter = 0
  },
  read_mirror = 0,
  callback_head = {
    next = 0x0 <fixed_percpu_data>,
    func = 0x0 <fixed_percpu_data>
  },
  lock_owner = 703,
  log_index = -1 '\377',
  lock = {
    count = {
      counter = 1
    },
    owner = {
      counter = -131387140126720
    },
    osq = {
      tail = {
        counter = 0
      }
    },
    wait_lock = {
      raw_lock = {
        {
          val = {
            counter = 0
          },
          {
            locked = 0 '\000',
            pending = 0 '\000'
          },
          {
            locked_pending = 0,
            tail = 0
          }
        }
      }
    },
    wait_list = {
      next = 0xffff888113e757d0,
      prev = 0xffff888113e757d0
    }
  },
  pages = {0xffffea0004425ac0, 0xffffea0004425b00, 0xffffea0004425b40, 0xffffea0004425b80, 0x0 <fixed_percpu_data> <repeats 12 times>},
  release_list = {
    next = 0xffff888113e75860,
    prev = 0xffff888113e75860
  },
  leak_list = {
    next = 0xffff888113e75760,
    prev = 0xffff888113e75650
  }
}
(gdb) p *block_group
$9 = {
  fs_info = 0xffff88810d42d000,
  inode = 0x0 <fixed_percpu_data>,
  lock = {
    {
      rlock = {
        raw_lock = {
          {
            val = {
              counter = 0
            },
            {
              locked = 0 '\000',
              pending = 0 '\000'
            },
            {
              locked_pending = 0,
              tail = 0
            }
          }
        }
      }
    }
  },
  start = 1342177280,
  length = 134217728,
  pinned = 0,
  reserved = 118784,
  used = 50720768,
  delalloc_bytes = 0,
  bytes_super = 0,
  flags = 1,
  cache_generation = 0,
  global_root_id = 256,
  bitmap_high_thresh = 179,
  bitmap_low_thresh = 79,
  data_rwsem = {
    count = {
      counter = 0
    },
    owner = {
      counter = -131387291393023
    },
    osq = {
      tail = {
        counter = 0
      }
    },
    wait_lock = {
      raw_lock = {
        {
          val = {
            counter = 0
          },
          {
            locked = 0 '\000',
            pending = 0 '\000'
          },
          {
            locked_pending = 0,
            tail = 0
          }
        }
      }
    },
    wait_list = {
      next = 0xffff88810d3c1088,
      prev = 0xffff88810d3c1088
    }
  },
  full_stripe_len = 4096,
  ro = 0,
  iref = 0,
  has_caching_ctl = 0,
  removed = 0,
  to_copy = 0,
  relocating_repair = 0,
  chunk_item_inserted = 1,
  zone_is_active = 1,
  disk_cache_state = 0,
  cached = 3,
  caching_ctl = 0x0 <fixed_percpu_data>,
  last_byte_to_unpin = 18446744073709551615,
  space_info = 0xffff88810d89a200,
  free_space_ctl = 0xffff88810b1d6e40,
  cache_node = {
    __rb_parent_color = 1,
    rb_right = 0xffff88810d3c3cd0,
    rb_left = 0xffff88810d3c38d0
  },
  list = {
    next = 0xffff88810d3c30e8,
    prev = 0xffff88810d89a328
  },
  refs = {
    refs = {
      counter = 3
    }
  },
  cluster_list = {
    next = 0xffff88810d3c1100,
    prev = 0xffff88810d3c1100
  },
  bg_list = {
    next = 0xffff88810d3c1110,
    prev = 0xffff88810d3c1110
  },
  ro_list = {
    next = 0xffff88810d3c1120,
    prev = 0xffff88810d3c1120
  },
  frozen = {
    counter = 0
  },
  discard_list = {
    next = 0xffff88810d3c1138,
    prev = 0xffff88810d3c1138
  },
  discard_index = 0,
  discard_eligible_time = 0,
  discard_cursor = 0,
  discard_state = BTRFS_DISCARD_EXTENTS,
  dirty_list = {
    next = 0xffff88810d3c1168,
    prev = 0xffff88810d3c1168
  },
  io_list = {
    next = 0xffff88810d3c1178,
    prev = 0xffff88810d3c1178
  },
  io_ctl = {
    cur = 0x0 <fixed_percpu_data>,
    orig = 0x0 <fixed_percpu_data>,
    page = 0x0 <fixed_percpu_data>,
    pages = 0x0 <fixed_percpu_data>,
    fs_info = 0x0 <fixed_percpu_data>,
    inode = 0x0 <fixed_percpu_data>,
    size = 0,
    index = 0,
    num_pages = 0,
    entries = 0,
    bitmaps = 0
  },
  reservations = {
    counter = 0
  },
  nocow_writers = {
    counter = 0
  },
  free_space_lock = {
    owner = {
      counter = -131387140126720
    },
    wait_lock = {
      raw_lock = {
        {
          val = {
            counter = 0
          },
          {
            locked = 0 '\000',
            pending = 0 '\000'
          },
          {
            locked_pending = 0,
            tail = 0
          }
        }
      }
    },
    osq = {
      tail = {
        counter = 0
      }
    },
    wait_list = {
      next = 0xffff88810d3c11e8,
      prev = 0xffff88810d3c11e8
    }
  },
  needs_free_space = 0,
  seq_zone = true,
  swap_extents = 0,
  full_stripe_locks_root = {
    root = {
      rb_node = 0x0 <fixed_percpu_data>
    },
    lock = {
      owner = {
        counter = 0
      },
      wait_lock = {
        raw_lock = {
          {
            val = {
              counter = 0
            },
            {
              locked = 0 '\000',
              pending = 0 '\000'
            },
            {
              locked_pending = 0,
              tail = 0
            }
          }
        }
      },
      osq = {
        tail = {
          counter = 0
        }
      },
      wait_list = {
        next = 0xffff88810d3c1220,
        prev = 0xffff88810d3c1220
      }
    }
  },
  alloc_offset = 67108864,
  zone_unusable = 83378176,
  zone_capacity = 67108864,
  meta_write_pointer = 1342177280,
  physical_map = 0xffff8881161dee80,
  active_bg_list = {
    next = 0xffff88810d3c3e58,
    prev = 0xffff88810d3c3a58
  }
}
(gdb) p *block_group->space_info
$10 = {
  lock = {
    {
      rlock = {
        raw_lock = {
          {
            val = {
              counter = 0
            },
            {
              locked = 0 '\000',
              pending = 0 '\000'
            },
            {
              locked_pending = 0,
              tail = 0
            }
          }
        }
      }
    }
  },
  total_bytes = 536870912,
  bytes_used = 76361728,
  bytes_pinned = 2240512,
  bytes_reserved = 1384448,
  bytes_may_use = 118784,
  bytes_readonly = 130383872,
  bytes_zone_unusable = 244887552,
  max_extent_size = 0,
  clamp = 6,
  full = 0,
  chunk_alloc = 0,
  flush = 0,
  force_alloc = 0,
  disk_used = 76361728,
  disk_total = 536870912,
  flags = 1,
  list = {
    next = 0xffff88810d89b870,
    prev = 0xffff88810d42d698
  },
  ro_bgs = {
    next = 0xffff88810d3c3120,
    prev = 0xffff88810d3c3120
  },
  priority_tickets = {
    next = 0xffff88810d89a290,
    prev = 0xffff88810d89a290
  },
  tickets = {
    next = 0xffff88810d89a2a0,
    prev = 0xffff88810d89a2a0
  },
  reclaim_size = 0,
  tickets_id = 7,
  groups_sem = {
    count = {
      counter = 0
    },
    owner = {
      counter = -131387291393023
    },
    osq = {
      tail = {
        counter = 0
      }
    },
    wait_lock = {
      raw_lock = {
        {
          val = {
            counter = 0
          },
          {
            locked = 0 '\000',
            pending = 0 '\000'
          },
          {
            locked_pending = 0,
            tail = 0
          }
        }
      }
    },
    wait_list = {
      next = 0xffff88810d89a2d8,
      prev = 0xffff88810d89a2d8
    }
  },
  block_groups = {{
      next = 0xffff88810d89a2e8,
      prev = 0xffff88810d89a2e8
    }, {
      next = 0xffff88810d89a2f8,
      prev = 0xffff88810d89a2f8
    }, {
      next = 0xffff88810d89a308,
      prev = 0xffff88810d89a308
    }, {
      next = 0xffff88810d89a318,
      prev = 0xffff88810d89a318
    }, {
      next = 0xffff88810d3c10e8,
      prev = 0xffff88810d3c24e8
    }, {
      next = 0xffff88810d89a338,
      prev = 0xffff88810d89a338
    }, {
      next = 0xffff88810d89a348,
      prev = 0xffff88810d89a348
    }, {
      next = 0xffff88810d89a358,
      prev = 0xffff88810d89a358
    }, {
      next = 0xffff88810d89a368,
      prev = 0xffff88810d89a368
    }},
  kobj = {
    name = 0xffff888100c92a80 "data",
    entry = {
      next = 0xffff88810d89a380,
      prev = 0xffff88810d89a380
    },
    parent = 0xffff88811a5e8380,
    kset = 0x0 <fixed_percpu_data>,
    ktype = 0xffffffffa0200ac0 <space_info_ktype>,
    sd = 0xffff88810f7ff100,
    kref = {
      refcount = {
        refs = {
          counter = 2
        }
      }
    },
    state_initialized = 1,
    state_in_sysfs = 1,
    state_add_uevent_sent = 0,
    state_remove_uevent_sent = 0,
    uevent_suppress = 0
  },
  block_group_kobjs = {0x0 <fixed_percpu_data>, 0x0 <fixed_percpu_data>, 0x0 <fixed_percpu_data>, 0x0 <fixed_percpu_data>, 0xffff8881030b4488, 0x0 <fixed_percpu_data>, 0x0 <fixed_percpu_data>, 0x0 <fixed_percpu_data>, 0x0 <fixed_percpu_data>}
}
(gdb) p *block_group->physical_map 
$11 = {
  type = 1,
  io_align = 65536,
  io_width = 65536,
  stripe_len = 65536,
  num_stripes = 1,
  sub_stripes = 1,
  verified_stripes = 371060352,
  stripes = 0xffff8881161deea8
}
(gdb) p *block_group->physical_map->stripes
$12 = {
  dev = 0xffff88810d8a1400,
  physical = 1342177280,
  length = 0
}
(gdb) p *block_group->physical_map->stripes->dev
$13 = {
  dev_list = {
    next = 0xffff88810d8a0298,
    prev = 0xffff88810d8a0298
  },
  dev_alloc_list = {
    next = 0xffff88810d8a02a8,
    prev = 0xffff88810d8a02a8
  },
  post_commit_list = {
    next = 0xffff88810d8a1420,
    prev = 0xffff88810d8a1420
  },
  fs_devices = 0xffff88810d8a0200,
  fs_info = 0xffff88810d42d000,
  name = 0xffff88810035b520,
  generation = 6,
  bdev = 0xffff8881006f3700,
  zone_info = 0xffff88810d89be00,
  mode = 131,
  devt = 263192577,
  dev_state = 3,
  last_flush_error = 0 '\000',
  devid = 1,
  total_bytes = 13421772800,
  disk_total_bytes = 13421772800,
  bytes_used = 1073741824,
  io_align = 4096,
  io_width = 4096,
  type = 0,
  sector_size = 4096,
  uuid = "z\335\313P\217\222K\361\207Tg\252?\035\351", <incomplete sequence \337>,
  commit_total_bytes = 13421772800,
  commit_bytes_used = 1073741824,
  flush_bio = 0xffff88810f75bc80,
  flush_wait = {
    done = 0,
    wait = {
      lock = {
        raw_lock = {
          {
            val = {
              counter = 0
            },
            {
              locked = 0 '\000',
              pending = 0 '\000'
            },
            {
              locked_pending = 0,
              tail = 0
            }
          }
        }
      },
      task_list = {
        next = 0x0 <fixed_percpu_data>,
        prev = 0x0 <fixed_percpu_data>
      }
    }
  },
  scrub_ctx = 0x0 <fixed_percpu_data>,
  dev_stats_valid = 1,
  dev_stats_ccnt = {
    counter = 2
  },
  dev_stat_values = {{
      counter = 2
    }, {
      counter = 0
    }, {
      counter = 0
    }, {
      counter = 0
    }, {
      counter = 0
    }},
  alloc_state = {
    state = {
      rb_node = 0xffff8881233da010
    },
    fs_info = 0x0 <fixed_percpu_data>,
    private_data = 0x0 <fixed_percpu_data>,
    dirty_bytes = 1073741824,
    track_uptodate = false,
    owner = 11 '\v',
    lock = {
      {
        rlock = {
          raw_lock = {
            {
              val = {
                counter = 0
              },
              {
                locked = 0 '\000',
                pending = 0 '\000'
              },
              {
                locked_pending = 0,
                tail = 0
              }
            }
          }
        }
      }
    }
  },
  kobj_unregister = {
    done = 0,
    wait = {
      lock = {
        raw_lock = {
          {
            val = {
              counter = 0
            },
            {
              locked = 0 '\000',
              pending = 0 '\000'
            },
            {
              locked_pending = 0,
              tail = 0
            }
          }
        }
      },
      task_list = {
        next = 0xffff88810d8a1558,
        prev = 0xffff88810d8a1558
      }
    }
  },
  devid_kobj = {
    name = 0xffff888100c92a08 "1",
    entry = {
      next = 0xffff88810d8a1570,
      prev = 0xffff88810d8a1570
    },
    parent = 0xffff88811a5e85c0,
    kset = 0x0 <fixed_percpu_data>,
    ktype = 0xffffffffa0200720 <devid_ktype>,
    sd = 0xffff88810ed7a200,
    kref = {
      refcount = {
        refs = {
          counter = 1
        }
      }
    },
    state_initialized = 1,
    state_in_sysfs = 1,
    state_add_uevent_sent = 0,
    state_remove_uevent_sent = 0,
    uevent_suppress = 0
  },
  scrub_speed_max = 0
}
(gdb) p *block_group->physical_map->stripes->dev->zone_info
$14 = {
  zone_size = 134217728,
  zone_size_shift = 27 '\033',
  nr_zones = 100,
  max_active_zones = 14,
  active_zones_left = {
    counter = 6
  },
  seq_zones = 0xffff88810b448cc0,
  empty_zones = 0xffff88810b448cd0,
  active_zones = 0xffff88810b448ce0,
  zone_cache = 0x0 <fixed_percpu_data>,
  sb_zones = {{
      start = 0,
      len = 262144,
      wp = 2552,
      type = 2 '\002',
      cond = 2 '\002',
      non_seq = 0 '\000',
      reset = 0 '\000',
      resv = "\000\000\000",
      capacity = 131072,
      reserved = '\000' <repeats 23 times>
    }, {
      start = 262144,
      len = 262144,
      wp = 262144,
      type = 2 '\002',
      cond = 1 '\001',
      non_seq = 0 '\000',
      reset = 0 '\000',
      resv = "\000\000\000",
      capacity = 131072,
      reserved = '\000' <repeats 23 times>
    }, {
      start = 0,
      len = 0,
      wp = 0,
      type = 0 '\000',
      cond = 0 '\000',
      non_seq = 0 '\000',
      reset = 0 '\000',
      resv = "\000\000\000",
      capacity = 0,
      reserved = '\000' <repeats 23 times>
    }, {
      start = 0,
      len = 0,
      wp = 0,
      type = 0 '\000',
      cond = 0 '\000',
      non_seq = 0 '\000',
      reset = 0 '\000',
      resv = "\000\000\000",
      capacity = 0,
      reserved = '\000' <repeats 23 times>
    }, {
      start = 0,
      len = 0,
      wp = 0,
      type = 0 '\000',
      cond = 0 '\000',
      non_seq = 0 '\000',
      reset = 0 '\000',
      resv = "\000\000\000",
      capacity = 0,
      reserved = '\000' <repeats 23 times>
    }, {
      start = 0,
      len = 0,
      wp = 0,
      type = 0 '\000',
      cond = 0 '\000',
      non_seq = 0 '\000',
      reset = 0 '\000',
      resv = "\000\000\000",
      capacity = 0,
      reserved = '\000' <repeats 23 times>
    }}
}
morbidrsa commented 2 years ago

Here's the stack trace

generic/068     [    1.398244] run fstests generic/068 at 2022-03-07 13:17:03
[   12.527832] assertion failed: start >= found_start && end <= found_end, in fs/btrfs/free-space-tree.c:737
[   12.528876] ------------[ cut here ]------------
[   12.529399] kernel BUG at fs/btrfs/ctree.h:3551!
[   12.529908] invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
[   12.530381] CPU: 0 PID: 694 Comm: kworker/u4:3 Not tainted 5.17.0-rc6-dennis #84
[   12.531160] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1.fc35 04/01/2014
[   12.531960] Workqueue: events_unbound btrfs_reclaim_bgs_work [btrfs]
[   12.532614] RIP: 0010:assertfail.constprop.0+0x18/0x1a [btrfs]
[   12.533182] Code: 9a 26 1b a0 48 c7 c7 70 d8 1b a0 e8 84 02 43 e1 0f 0b 89 f1 48 c7 c2 cd 26 1b a0 48 89 fe 48 c7 c7 98 d8 1b a0 e8 6a 02 43 e1 <0f> 0b be 8c 00 00 00 48 c7 c7 f9 26 1b a0 e8 d5 ff ff ff be 91 00
[   12.533391] RSP: 0018:ffffc90000cffa58 EFLAGS: 00010282
[   12.533391] RAX: 000000000000005d RBX: 0000000063f5c000 RCX: 0000000000000000
[   12.533391] RDX: 0000000000000001 RSI: 00000000ffffffea RDI: 00000000ffffffff
[   12.533391] RBP: ffff888116a59400 R08: ffffffff81ea4f88 R09: 00000000ffffefff
[   12.533391] R10: ffffffff81e34fa0 R11: ffffffff81e34fa0 R12: ffff888114d42460
[   12.533391] R13: ffff88810045ddd0 R14: 0000000063f9d000 R15: ffff88810408e800
[   12.533391] FS:  0000000000000000(0000) GS:ffff888627c00000(0000) knlGS:0000000000000000
[   12.533391] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   12.533391] CR2: 00007f36a24d9000 CR3: 00000001518d0000 CR4: 00000000000006b0
[   12.533391] Call Trace:
[   12.533391]  <TASK>
[   12.533391]  __remove_from_free_space_tree.cold+0x11/0x22 [btrfs]
[   12.542073]  ? setup_items_for_insert.isra.0+0x2bf/0x3f0 [btrfs]
[   12.542073]  remove_from_free_space_tree+0x80/0x110 [btrfs]
[   12.542073]  alloc_reserved_file_extent+0x1b4/0x240 [btrfs]
[   12.542073]  __btrfs_run_delayed_refs+0x692/0xf30 [btrfs]
[   12.542073]  ? btrfs_btree_balance_dirty+0x2f/0x50 [btrfs]
[   12.542073]  btrfs_run_delayed_refs+0x81/0x1e0 [btrfs]
[   12.542073]  btrfs_commit_transaction+0x54/0xaf0 [btrfs]
[   12.542073]  ? start_transaction+0xc2/0x5b0 [btrfs]
[   12.542073]  ? _raw_read_lock_irqsave+0x20/0x40
[   12.542073]  relocate_block_group+0x320/0x550 [btrfs]
[   12.542073]  btrfs_relocate_block_group+0x1f9/0x3a0 [btrfs]
[   12.542073]  btrfs_relocate_chunk+0x36/0xf0 [btrfs]
[   12.542073]  btrfs_reclaim_bgs_work.cold+0x4f/0x74 [btrfs]
[   12.542073]  process_one_work+0x1b0/0x310
[   12.542073]  worker_thread+0x48/0x3d0
[   12.542073]  ? rescuer_thread+0x3a0/0x3a0
[   12.542073]  kthread+0xed/0x120
[   12.550506]  ? kthread_complete_and_exit+0x20/0x20
[   12.550506]  ret_from_fork+0x22/0x30
[   12.550506]  </TASK>
[   12.550506] Modules linked in: btrfs blake2b_generic xor lzo_compress zlib_deflate raid6_pq zstd_decompress zstd_compress xxhash null_blk
[   12.553118] ---[ end trace 0000000000000000 ]---
[   12.553574] RIP: 0010:assertfail.constprop.0+0x18/0x1a [btrfs]
[   12.554206] Code: 9a 26 1b a0 48 c7 c7 70 d8 1b a0 e8 84 02 43 e1 0f 0b 89 f1 48 c7 c2 cd 26 1b a0 48 89 fe 48 c7 c7 98 d8 1b a0 e8 6a 02 43 e1 <0f> 0b be 8c 00 00 00 48 c7 c7 f9 26 1b a0 e8 d5 ff ff ff be 91 00
[   12.556091] RSP: 0018:ffffc90000cffa58 EFLAGS: 00010282
[   12.556570] RAX: 000000000000005d RBX: 0000000063f5c000 RCX: 0000000000000000
[   12.557269] RDX: 0000000000000001 RSI: 00000000ffffffea RDI: 00000000ffffffff
[   12.557940] RBP: ffff888116a59400 R08: ffffffff81ea4f88 R09: 00000000ffffefff
[   12.558629] R10: ffffffff81e34fa0 R11: ffffffff81e34fa0 R12: ffff888114d42460
[   12.559319] R13: ffff88810045ddd0 R14: 0000000063f9d000 R15: ffff88810408e800
[   12.560014] FS:  0000000000000000(0000) GS:ffff888627c00000(0000) knlGS:0000000000000000
[   12.560766] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   12.561329] CR2: 00007f36a24d9000 CR3: 00000001518d0000 CR4: 00000000000006b0
naota commented 2 years ago

While it can be interesting to trace what happening here, but I just want to disable FREESPACE_TREE on zoned btrfs in the first place.

Since we do the simple sequential allocation, it's no use to maintain the tree. And, actually, I think the zoned allocator is not doing the maintenance correctly.

naota commented 2 years ago

It should be fixed with 343d8a30851c ("btrfs: zoned: prevent allocation from previous data relocation BG")