]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: zoned: fix linked list corruption after log root tree allocation failure
authorFilipe Manana <fdmanana@suse.com>
Thu, 11 Mar 2021 15:13:30 +0000 (15:13 +0000)
committerDavid Sterba <dsterba@suse.com>
Mon, 15 Mar 2021 15:57:19 +0000 (16:57 +0100)
commitecc5f53f4a85bc2cffb628ec511921bc535c17ee
treead175deedb026e3125dcdcd6aba170900921e843
parentad9db1398ac23800ba0f791c9a1b89d6f05dea23
btrfs: zoned: fix linked list corruption after log root tree allocation failure

When using a zoned filesystem, while syncing the log, if we fail to
allocate the root node for the log root tree, we are not removing the
log context we allocated on stack from the list of log contexts of the
log root tree. This means after the return from btrfs_sync_log() we get
a corrupted linked list.

Fix this by allocating the node before adding our stack allocated context
to the list of log contexts of the log root tree.

Fixes: 6c455433ae6907 ("btrfs: zoned: reorder log node allocation on zoned filesystem")
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/tree-log.c