• Josef Bacik's avatar
    btrfs: use btrfs_handle_fs_error in btrfs_fill_super · 13b98989
    Josef Bacik authored
    While trying to track down a lost EIO problem I hit the following
    assertion while doing my error injection testing
    
      BTRFS warning (device nvme1n1): transaction 1609 (with 180224 dirty metadata bytes) is not committed
      assertion failed: !found, in fs/btrfs/disk-io.c:4456
      ------------[ cut here ]------------
      kernel BUG at fs/btrfs/messages.h:169!
      invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
      CPU: 0 PID: 1445 Comm: mount Tainted: G        W          6.2.0-rc5+ #3
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.1-2.fc37 04/01/2014
      RIP: 0010:btrfs_assertfail.constprop.0+0x18/0x1a
      RSP: 0018:ffffb95fc3b0bc68 EFLAGS: 00010286
      RAX: 0000000000000034 RBX: ffff9941c2ac2000 RCX: 0000000000000000
      RDX: 0000000000000001 RSI: ffffffffb6741f7d RDI: 00000000ffffffff
      RBP: ffff9941c2ac2428 R08: 0000000000000000 R09: ffffb95fc3b0bb38
      R10: 0000000000000003 R11: ffffffffb71438a8 R12: ffff9941c2ac2428
      R13: ffff9941c2ac2450 R14: ffff9941c2ac2450 R15: 000000000002c000
      FS:  00007fcea2d07800(0000) GS:ffff9941fbc00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007f00cc7c83a8 CR3: 000000010c686000 CR4: 0000000000350ef0
      Call Trace:
       <TASK>
       close_ctree+0x426/0x48f
       btrfs_mount_root.cold+0x7e/0xee
       ? legacy_parse_param+0x2b/0x220
       legacy_get_tree+0x2b/0x50
       vfs_get_tree+0x29/0xc0
       vfs_kern_mount.part.0+0x73/0xb0
       btrfs_mount+0x11d/0x3d0
       ? legacy_parse_param+0x2b/0x220
       legacy_get_tree+0x2b/0x50
       vfs_get_tree+0x29/0xc0
       path_mount+0x438/0xa40
       __x64_sys_mount+0xe9/0x130
       do_syscall_64+0x3e/0x90
       entry_SYSCALL_64_after_hwframe+0x72/0xdc
    
    This is because the error injection did an EIO for the root inode lookup
    and we simply jumped to closing the ctree.  However because we didn't
    mark the file system as having an error we skipped all of the broken
    transaction cleanup stuff, and thus triggered this ASSERT().  Fix this
    by calling btrfs_handle_fs_error() in this case so we have the error set
    on the file system.
    Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
    Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    13b98989
super.c 68.4 KB