forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'block-5.8-2020-06-19' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe: - Use import_uuid() where appropriate (Andy) - bcache fixes (Coly, Mauricio, Zhiqiang) - blktrace sparse warnings fix (Jan) - blktrace concurrent setup fix (Luis) - blkdev_get use-after-free fix (Jason) - Ensure all blk-mq maps are updated (Weiping) - Loop invalidate bdev fix (Zheng) * tag 'block-5.8-2020-06-19' of git://git.kernel.dk/linux-block: block: make function 'kill_bdev' static loop: replace kill_bdev with invalidate_bdev partitions/ldm: Replace uuid_copy() with import_uuid() where it makes sense block: update hctx map when use multiple maps blktrace: Avoid sparse warnings when assigning q->blk_trace blktrace: break out of blktrace setup on concurrent calls block: Fix use-after-free in blkdev_get() trace/events/block.h: drop kernel-doc for dropped function parameter blk-mq: Remove redundant 'return' statement bcache: pr_info() format clean up in bcache_device_init() bcache: use delayed kworker fo asynchronous devices registration bcache: check and adjust logical block size for backing devices bcache: fix potential deadlock problem in btree_gc_coalesce
- Loading branch information
Showing
10 changed files
with
70 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,9 @@ | |
* Copyright (C) 2006 Jens Axboe <[email protected]> | ||
* | ||
*/ | ||
|
||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
|
||
#include <linux/kernel.h> | ||
#include <linux/blkdev.h> | ||
#include <linux/blktrace_api.h> | ||
|
@@ -344,7 +347,8 @@ static int __blk_trace_remove(struct request_queue *q) | |
{ | ||
struct blk_trace *bt; | ||
|
||
bt = xchg(&q->blk_trace, NULL); | ||
bt = rcu_replace_pointer(q->blk_trace, NULL, | ||
lockdep_is_held(&q->blk_trace_mutex)); | ||
if (!bt) | ||
return -EINVAL; | ||
|
||
|
@@ -494,6 +498,17 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev, | |
*/ | ||
strreplace(buts->name, '/', '_'); | ||
|
||
/* | ||
* bdev can be NULL, as with scsi-generic, this is a helpful as | ||
* we can be. | ||
*/ | ||
if (rcu_dereference_protected(q->blk_trace, | ||
lockdep_is_held(&q->blk_trace_mutex))) { | ||
pr_warn("Concurrent blktraces are not allowed on %s\n", | ||
buts->name); | ||
return -EBUSY; | ||
} | ||
|
||
bt = kzalloc(sizeof(*bt), GFP_KERNEL); | ||
if (!bt) | ||
return -ENOMEM; | ||
|
@@ -543,10 +558,7 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev, | |
bt->pid = buts->pid; | ||
bt->trace_state = Blktrace_setup; | ||
|
||
ret = -EBUSY; | ||
if (cmpxchg(&q->blk_trace, NULL, bt)) | ||
goto err; | ||
|
||
rcu_assign_pointer(q->blk_trace, bt); | ||
get_probe_ref(); | ||
|
||
ret = 0; | ||
|
@@ -1629,7 +1641,8 @@ static int blk_trace_remove_queue(struct request_queue *q) | |
{ | ||
struct blk_trace *bt; | ||
|
||
bt = xchg(&q->blk_trace, NULL); | ||
bt = rcu_replace_pointer(q->blk_trace, NULL, | ||
lockdep_is_held(&q->blk_trace_mutex)); | ||
if (bt == NULL) | ||
return -EINVAL; | ||
|
||
|
@@ -1661,10 +1674,7 @@ static int blk_trace_setup_queue(struct request_queue *q, | |
|
||
blk_trace_setup_lba(bt, bdev); | ||
|
||
ret = -EBUSY; | ||
if (cmpxchg(&q->blk_trace, NULL, bt)) | ||
goto free_bt; | ||
|
||
rcu_assign_pointer(q->blk_trace, bt); | ||
get_probe_ref(); | ||
return 0; | ||
|
||
|