Skip to content
  1. Feb 26, 2024
  2. Feb 25, 2024
  3. Feb 14, 2024
  4. Feb 11, 2024
    • Kent Overstreet's avatar
    • Su Yue's avatar
      bcachefs: fix kmemleak in __bch2_read_super error handling path · 7dcfb87a
      Su Yue authored
      
      
      During xfstest tests, there are some kmemleak reports e.g. generic/051 with
      if USE_KMEMLEAK=yes:
      
      ====================================================================
      EXPERIMENTAL kmemleak reported some memory leaks!  Due to the way kmemleak
      works, the leak might be from an earlier test, or something totally unrelated.
      unreferenced object 0xffff9ef905aaf778 (size 8):
        comm "mount.bcachefs", pid 169844, jiffies 4295281209 (age 87.040s)
        hex dump (first 8 bytes):
          a5 cc cc cc cc cc cc cc                          ........
        backtrace:
          [<ffffffff87fd9a43>] __kmem_cache_alloc_node+0x1f3/0x2c0
          [<ffffffff87f49b66>] kmalloc_trace+0x26/0xb0
          [<ffffffffc0a3fefe>] __bch2_read_super+0xfe/0x4e0 [bcachefs]
          [<ffffffffc0a3ad22>] bch2_fs_open+0x262/0x1710 [bcachefs]
          [<ffffffffc09c9e24>] bch2_mount+0x4c4/0x640 [bcachefs]
          [<ffffffff88080c90>] legacy_get_tree+0x30/0x60
          [<ffffffff8802c748>] vfs_get_tree+0x28/0xf0
          [<ffffffff88061fe5>] path_mount+0x475/0xb60
          [<ffffffff880627e5>] __x64_sys_mount+0x105/0x140
          [<ffffffff88932642>] do_syscall_64+0x42/0xf0
          [<ffffffff88a000e6>] entry_SYSCALL_64_after_hwframe+0x6e/0x76
      unreferenced object 0xffff9ef96cdc4fc0 (size 32):
        comm "mount.bcachefs", pid 169844, jiffies 4295281209 (age 87.040s)
        hex dump (first 32 bytes):
          2f 64 65 76 2f 6d 61 70 70 65 72 2f 74 65 73 74  /dev/mapper/test
          2d 31 00 cc cc cc cc cc cc cc cc cc cc cc cc cc  -1..............
        backtrace:
          [<ffffffff87fd9a43>] __kmem_cache_alloc_node+0x1f3/0x2c0
          [<ffffffff87f4a081>] __kmalloc_node_track_caller+0x51/0x150
          [<ffffffff87f3adc2>] kstrdup+0x32/0x60
          [<ffffffffc0a3ff1a>] __bch2_read_super+0x11a/0x4e0 [bcachefs]
          [<ffffffffc0a3ad22>] bch2_fs_open+0x262/0x1710 [bcachefs]
          [<ffffffffc09c9e24>] bch2_mount+0x4c4/0x640 [bcachefs]
          [<ffffffff88080c90>] legacy_get_tree+0x30/0x60
          [<ffffffff8802c748>] vfs_get_tree+0x28/0xf0
          [<ffffffff88061fe5>] path_mount+0x475/0xb60
          [<ffffffff880627e5>] __x64_sys_mount+0x105/0x140
          [<ffffffff88932642>] do_syscall_64+0x42/0xf0
          [<ffffffff88a000e6>] entry_SYSCALL_64_after_hwframe+0x6e/0x76
      ====================================================================
      
      The leak happens if bdev_open_by_path() failed to open a block device
      then it goes label 'out' directly without call of bch2_free_super().
      
      Fix it by going to label 'err' instead of 'out' if bdev_open_by_path()
      fails.
      
      Signed-off-by: default avatarSu Yue <glass.su@suse.com>
      Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
      7dcfb87a
    • Kent Overstreet's avatar
      bcachefs: Fix missing bch2_err_class() calls · 1a1c93e7
      Kent Overstreet authored
      
      
      We aren't supposed to be leaking our private error codes outside of
      fs/bcachefs/.
      
      Fixes:
      Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
      1a1c93e7
  5. Feb 05, 2024
  6. Jan 29, 2024
  7. Jan 26, 2024
    • Kent Overstreet's avatar
      bcachefs: __lookup_dirent() works in snapshot, not subvol · d2fda304
      Kent Overstreet authored
      
      
      Add a new helper, bch2_hash_lookup_in_snapshot(), for when we're not
      operating in a subvolume and already have a snapshot ID, and then use it
      in lookup_lostfound() -> __lookup_dirent().
      
      This is a bugfix - lookup_lostfound() doesn't take a subvolume ID, we
      were passing a nonsense subvolume ID before, and don't have one to pass
      since we may be operating in an interior snapshot node that doesn't have
      a subvolume ID.
      
      Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
      d2fda304
  8. Jan 25, 2024
  9. Jan 23, 2024
  10. Jan 22, 2024