• Paolo Valente's avatar
    block, bfq: fix queue removal from weights tree · 8b3b22aa
    Paolo Valente authored
    [ Upstream commit 9dee8b3b ]
    
    bfq maintains an ordered list, through a red-black tree, of unique
    weights of active bfq_queues. This list is used to detect whether there
    are active queues with differentiated weights. The weight of a queue is
    removed from the list when both the following two conditions become
    true:
    
    (1) the bfq_queue is flagged as inactive
    (2) the has no in-flight request any longer;
    
    Unfortunately, in the rare cases where condition (2) becomes true before
    condition (1), the removal fails, because the function to remove the
    weight of the queue (bfq_weights_tree_remove) is rightly invoked in the
    path that deactivates the bfq_queue, but mistakenly invoked *before* the
    function that actually performs the deactivation (bfq_deactivate_bfqq).
    
    This commits moves the invocation of bfq_weights_tree_remove for
    condition (1) to after bfq_deactivate_bfqq. As a consequence of this
    move, it is necessary to add a further reference to the queue when the
    weight of a queue is added, because the queue might otherwise be freed
    before bfq_weights_tree_remove is invoked. This commit adds this
    reference and makes all related modifications.
    Signed-off-by: 's avatarPaolo Valente <paolo.valente@linaro.org>
    Signed-off-by: 's avatarJens Axboe <axboe@kernel.dk>
    Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
    8b3b22aa
Name
Last commit
Last update
..
partitions Loading commit data...
Kconfig Loading commit data...
Kconfig.iosched Loading commit data...
Makefile Loading commit data...
badblocks.c Loading commit data...
bfq-cgroup.c Loading commit data...
bfq-iosched.c Loading commit data...
bfq-iosched.h Loading commit data...
bfq-wf2q.c Loading commit data...
bio-integrity.c Loading commit data...
bio.c Loading commit data...
blk-cgroup.c Loading commit data...
blk-core.c Loading commit data...
blk-exec.c Loading commit data...
blk-flush.c Loading commit data...
blk-integrity.c Loading commit data...
blk-ioc.c Loading commit data...
blk-iolatency.c Loading commit data...
blk-lib.c Loading commit data...
blk-map.c Loading commit data...
blk-merge.c Loading commit data...
blk-mq-cpumap.c Loading commit data...
blk-mq-debugfs-zoned.c Loading commit data...
blk-mq-debugfs.c Loading commit data...
blk-mq-debugfs.h Loading commit data...
blk-mq-pci.c Loading commit data...
blk-mq-rdma.c Loading commit data...
blk-mq-sched.c Loading commit data...
blk-mq-sched.h Loading commit data...
blk-mq-sysfs.c Loading commit data...
blk-mq-tag.c Loading commit data...
blk-mq-tag.h Loading commit data...
blk-mq-virtio.c Loading commit data...
blk-mq.c Loading commit data...
blk-mq.h Loading commit data...
blk-pm.c Loading commit data...
blk-pm.h Loading commit data...
blk-rq-qos.c Loading commit data...
blk-rq-qos.h Loading commit data...
blk-settings.c Loading commit data...
blk-softirq.c Loading commit data...
blk-stat.c Loading commit data...
blk-stat.h Loading commit data...
blk-sysfs.c Loading commit data...
blk-throttle.c Loading commit data...
blk-timeout.c Loading commit data...
blk-wbt.c Loading commit data...
blk-wbt.h Loading commit data...
blk-zoned.c Loading commit data...
blk.h Loading commit data...
bounce.c Loading commit data...
bsg-lib.c Loading commit data...
bsg.c Loading commit data...
cmdline-parser.c Loading commit data...
compat_ioctl.c Loading commit data...
elevator.c Loading commit data...
genhd.c Loading commit data...
ioctl.c Loading commit data...
ioprio.c Loading commit data...
kyber-iosched.c Loading commit data...
mq-deadline.c Loading commit data...
opal_proto.h Loading commit data...
partition-generic.c Loading commit data...
scsi_ioctl.c Loading commit data...
sed-opal.c Loading commit data...
t10-pi.c Loading commit data...