Josef Bacik
026f830e0b
btrfs: fix double put of block group with nocow
...
commit 230ed397435e85b54f055c524fcb267ae2ce3bc4 upstream.
While debugging a patch that I wrote I was hitting use-after-free panics
when accessing block groups on unmount. This turned out to be because
in the nocow case if we bail out of doing the nocow for whatever reason
we need to call btrfs_dec_nocow_writers() if we called the inc. This
puts our block group, but a few error cases does
if (nocow) {
btrfs_dec_nocow_writers();
goto error;
}
unfortunately, error is
error:
if (nocow)
btrfs_dec_nocow_writers();
so we get a double put on our block group. Fix this by dropping the
error cases calling of btrfs_dec_nocow_writers(), as it's handled at the
error label now.
Fixes: 762bf09893 ("btrfs: improve error handling in run_delalloc_nocow")
CC: [email protected] # 5.4+
Reviewed-by: Filipe Manana <[email protected] >
Signed-off-by: Josef Bacik <[email protected] >
Reviewed-by: David Sterba <[email protected] >
Signed-off-by: David Sterba <[email protected] >
Signed-off-by: Greg Kroah-Hartman <[email protected] >
2020-07-16 08:16:45 +02:00
..
tests
btrfs: Correctly handle empty trees in find_first_clear_extent_bit
2020-02-11 04:35:34 -08:00
acl.c
btrfs: cleanup btrfs_setxattr_trans and drop transaction parameter
2019-04-29 19:02:44 +02:00
async-thread.c
Btrfs: fix crash during unmount due to race with delayed inode workers
2020-04-17 10:50:15 +02:00
async-thread.h
Btrfs: fix crash during unmount due to race with delayed inode workers
2020-04-17 10:50:15 +02:00
backref.c
Btrfs: fix deadlock between fiemap and transaction commits
2019-07-30 18:25:12 +02:00
backref.h
btrfs: fiemap: preallocate ulists for btrfs_check_shared
2019-07-01 13:34:53 +02:00
block-group.c
btrfs: fix a block group ref counter leak after failure to remove block group
2020-06-30 15:36:47 -04:00
block-group.h
btrfs: move struct io_ctl to free-space-cache.h
2019-09-09 14:59:15 +02:00
block-rsv.c
btrfs: force chunk allocation if our global rsv is larger than metadata
2020-06-22 09:31:13 +02:00
block-rsv.h
btrfs: migrate the global_block_rsv helpers to block-rsv.c
2019-07-02 12:30:55 +02:00
btrfs_inode.h
btrfs: remove assumption about csum type form btrfs_print_data_csum_error()
2019-07-01 13:35:02 +02:00
check-integrity.c
btrfs: fix possible NULL-pointer dereference in integrity checks
2020-02-24 08:36:53 +01:00
check-integrity.h
compression.c
btrfs: move cond_wake_up functions out of ctree
2019-09-09 14:59:15 +02:00
compression.h
btrfs: compression: replace set_level callbacks by a common helper
2019-09-09 14:59:11 +02:00
ctree.c
Btrfs: fix race between adding and putting tree mod seq elements and nodes
2020-02-11 04:35:34 -08:00
ctree.h
btrfs: check if a log root exists before locking the log_mutex on unlink
2020-06-30 15:37:08 -04:00
delalloc-space.c
Btrfs: fix qgroup double free after failure to reserve metadata for delalloc
2019-10-17 20:13:44 +02:00
delalloc-space.h
btrfs: migrate the delalloc space stuff to it's own home
2019-07-04 17:26:17 +02:00
delayed-inode.c
btrfs: use nofs allocations for running delayed items
2020-04-17 10:50:15 +02:00
delayed-inode.h
delayed-ref.c
Btrfs: fix race between adding and putting tree mod seq elements and nodes
2020-02-11 04:35:34 -08:00
delayed-ref.h
btrfs: migrate the delayed refs rsv code
2019-07-04 17:26:17 +02:00
dev-replace.c
btrfs: move cond_wake_up functions out of ctree
2019-09-09 14:59:15 +02:00
dev-replace.h
btrfs: get fs_info from trans in btrfs_run_dev_replace
2019-04-29 19:02:43 +02:00
dir-item.c
btrfs: remove unused parameter fs_info from btrfs_extend_item
2019-04-29 19:02:50 +02:00
disk-io.c
btrfs: set update the uuid generation as soon as possible
2020-04-17 10:50:15 +02:00
disk-io.h
btrfs: Make reada_tree_block_flagged private
2019-09-09 14:59:11 +02:00
export.c
export.h
extent-tree.c
btrfs: handle logged extent failure properly
2020-02-28 17:22:13 +01:00
extent_io.c
btrfs: fix fatal extent_buffer readahead vs releasepage race
2020-07-16 08:16:45 +02:00
extent_io.h
btrfs: Remove delalloc_end argument from extent_clear_unlock_delalloc
2019-09-09 14:58:59 +02:00
extent_map.c
Btrfs: fix race between using extent maps and merging them
2020-02-19 19:53:00 +01:00
extent_map.h
file-item.c
btrfs: do not ignore error from btrfs_next_leaf() when inserting checksums
2020-06-22 09:30:55 +02:00
file.c
btrfs: fix missing semaphore unlock in btrfs_sync_file
2020-04-17 10:50:15 +02:00
free-space-cache.c
btrfs: check page->mapping when loading free space cache
2019-12-17 19:56:02 +01:00
free-space-cache.h
btrfs: move struct io_ctl to free-space-cache.h
2019-09-09 14:59:15 +02:00
free-space-tree.c
btrfs: move basic block_group definitions to their own header
2019-09-09 14:59:03 +02:00
free-space-tree.h
btrfs: move basic block_group definitions to their own header
2019-09-09 14:59:03 +02:00
inode-item.c
btrfs: Make btrfs_find_name_in_ext_backref return struct btrfs_inode_extref
2019-09-09 14:59:16 +02:00
inode-map.c
btrfs: qgroup: Always free PREALLOC META reserve in btrfs_delalloc_release_extents()
2019-10-15 18:50:07 +02:00
inode-map.h
inode.c
btrfs: fix double put of block group with nocow
2020-07-16 08:16:45 +02:00
ioctl.c
Btrfs: make deduplication with range including the last block work
2020-02-11 04:35:33 -08:00
Kconfig
btrfs: Fix build error while LIBCRC32C is module
2019-07-17 17:03:30 +02:00
locking.c
btrfs: move cond_wake_up functions out of ctree
2019-09-09 14:59:15 +02:00
locking.h
btrfs: Remove unused locking functions
2019-09-09 14:58:59 +02:00
lzo.c
btrfs: compression: replace set_level callbacks by a common helper
2019-09-09 14:59:11 +02:00
Makefile
btrfs: migrate the block group lookup code
2019-09-09 14:59:04 +02:00
misc.h
btrfs: move math functions to misc.h
2019-09-09 14:59:15 +02:00
ordered-data.c
Btrfs: fix btrfs_wait_ordered_range() so that it waits for all ordered extents
2020-02-28 17:22:24 +01:00
ordered-data.h
btrfs: don't assume ordered sums to be 4 bytes
2019-07-01 13:35:00 +02:00
orphan.c
print-tree.c
btrfs: switch extent_buffer write_locks from atomic to int
2019-07-02 12:30:47 +02:00
print-tree.h
props.c
btrfs: rename the btrfs_calc_*_metadata_size helpers
2019-09-09 14:59:13 +02:00
props.h
btrfs: delete unused function btrfs_set_prop_trans
2019-04-29 19:02:54 +02:00
qgroup.c
btrfs: qgroup: mark qgroup inconsistent if we're inherting snapshot to a new qgroup
2020-06-22 09:31:09 +02:00
qgroup.h
btrfs: destroy qgroup extent records on transaction abort
2020-02-28 17:22:23 +01:00
raid56.c
btrfs: get rid of unique workqueue helper functions
2020-01-09 10:20:06 +01:00
raid56.h
btrfs: constify map parameter for nr_parity_stripes and nr_data_stripes
2019-07-01 13:34:58 +02:00
rcu-string.h
reada.c
btrfs: get rid of unique workqueue helper functions
2020-01-09 10:20:06 +01:00
ref-verify.c
btrfs: ref-verify: fix memory leaks
2020-02-19 19:53:00 +01:00
ref-verify.h
btrfs: ref-verify: Use btrfs_ref to refactor btrfs_ref_tree_mod()
2019-04-29 19:02:49 +02:00
relocation.c
btrfs: fix transaction leak in btrfs_recover_relocation
2020-05-06 08:15:05 +02:00
root-tree.c
btrfs: do not delete mismatched root refs
2020-01-23 08:22:40 +01:00
scrub.c
btrfs: get rid of unique workqueue helper functions
2020-01-09 10:20:06 +01:00
send.c
btrfs: send: emit file capabilities after chown
2020-06-22 09:31:12 +02:00
send.h
space-info.c
btrfs: improve global reserve stealing logic
2020-06-22 09:31:08 +02:00
space-info.h
btrfs: improve global reserve stealing logic
2020-06-22 09:31:08 +02:00
struct-funcs.c
btrfs: tie extent buffer and it's token together
2019-09-09 14:59:16 +02:00
super.c
btrfs: log message when rw remount is attempted with unclean tree-log
2020-02-19 19:53:01 +01:00
sysfs.c
btrfs: sysfs: move helper macros to sysfs.c
2019-09-09 14:59:08 +02:00
sysfs.h
btrfs: sysfs: move helper macros to sysfs.c
2019-09-09 14:59:08 +02:00
transaction.c
btrfs: force chunk allocation if our global rsv is larger than metadata
2020-06-22 09:31:13 +02:00
transaction.h
btrfs: improve global reserve stealing logic
2020-06-22 09:31:08 +02:00
tree-checker.c
Btrfs: make tree checker detect checksum items with overlapping ranges
2019-12-31 16:41:55 +01:00
tree-checker.h
btrfs: get fs_info from eb in btrfs_check_chunk_valid
2019-04-29 19:02:39 +02:00
tree-defrag.c
tree-log.c
btrfs: check if a log root exists before locking the log_mutex on unlink
2020-06-30 15:37:08 -04:00
tree-log.h
btrfs: get fs_info from trans in btrfs_set_log_full_commit
2019-04-29 19:02:41 +02:00
ulist.c
ulist.h
uuid-tree.c
btrfs: handle ENOENT in btrfs_uuid_tree_iterate
2019-12-31 16:42:05 +01:00
volumes.c
btrfs: include non-missing as a qualifier for the latest_bdev
2020-06-22 09:31:12 +02:00
volumes.h
btrfs: Remove btrfs_bio::flags member
2019-12-17 19:56:06 +01:00
xattr.c
Btrfs: fix failure to persist compression property xattr deletion on fsync
2019-06-17 16:37:17 +02:00
xattr.h
btrfs: cleanup btrfs_setxattr_trans and drop transaction parameter
2019-04-29 19:02:44 +02:00
zlib.c
btrfs: compression: replace set_level callbacks by a common helper
2019-09-09 14:59:11 +02:00
zstd.c
btrfs: move cond_wake_up functions out of ctree
2019-09-09 14:59:15 +02:00