diff options
author | David Jeffery <djeffery@redhat.com> | 2017-08-28 18:52:44 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2017-08-28 18:52:44 +0200 |
commit | e9a823fb34a8b0fcba6e112aa1003258a1a5af50 (patch) | |
tree | dd6507e25c254a6aa569b0f5c5451bba04b415d4 /drivers/net/slip/slip.c | |
parent | block, scheduler: convert xxx_var_store to void (diff) | |
download | linux-e9a823fb34a8b0fcba6e112aa1003258a1a5af50.tar.xz linux-e9a823fb34a8b0fcba6e112aa1003258a1a5af50.zip |
block: fix warning when I/O elevator is changed as request_queue is being removed
There is a race between changing I/O elevator and request_queue removal
which can trigger the warning in kobject_add_internal. A program can
use sysfs to request a change of elevator at the same time another task
is unregistering the request_queue the elevator would be attached to.
The elevator's kobject will then attempt to be connected to the
request_queue in the object tree when the request_queue has just been
removed from sysfs. This triggers the warning in kobject_add_internal
as the request_queue no longer has a sysfs directory:
kobject_add_internal failed for iosched (error: -2 parent: queue)
------------[ cut here ]------------
WARNING: CPU: 3 PID: 14075 at lib/kobject.c:244 kobject_add_internal+0x103/0x2d0
To fix this warning, we can check the QUEUE_FLAG_REGISTERED flag when
changing the elevator and use the request_queue's sysfs_lock to
serialize between clearing the flag and the elevator testing the flag.
Signed-off-by: David Jeffery <djeffery@redhat.com>
Tested-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/net/slip/slip.c')
0 files changed, 0 insertions, 0 deletions