]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: get rid of pointless wtag variable in async-thread.c
authorOmar Sandoval <osandov@fb.com>
Mon, 16 Sep 2019 18:30:58 +0000 (11:30 -0700)
committerDavid Sterba <dsterba@suse.com>
Mon, 18 Nov 2019 11:46:49 +0000 (12:46 +0100)
commit7e12e0cdea15b571d0ae73457e73c483a03278b9
treebaf390f2f39d5262b7bfaa43df57bc30945dd7ad
parent983b364374005d68ad52caf5cdacba6bab43cc2b
btrfs: get rid of pointless wtag variable in async-thread.c

Commit 8134fc3c3d47 ("btrfs: fix crash when tracepoint arguments are
freed by wq callbacks") added a void pointer, wtag, which is passed into
trace_btrfs_all_work_done() instead of the freed work item. This is
silly for a few reasons:

1. The freed work item still has the same address.
2. work is still in scope after it's freed, so assigning wtag doesn't
   stop anyone from using it.
3. The tracepoint has always taken a void * argument, so assigning wtag
   doesn't actually make things any more type-safe. (Note that the
   original bug in commit 0f9331d92898 ("btrfs: prefix fsid to all trace
   events") was that the void * was implicitly casted when it was passed
   to btrfs_work_owner() in the trace point itself).

Instead, let's add some clearer warnings as comments.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/async-thread.c
include/trace/events/btrfs.h