android_kernel_asus_sm8350/block
Ming Lei db5e1fbf5e BACKPORT: blk-mq: fix is_flush_rq
is_flush_rq() is called from bt_iter()/bt_tags_iter(), and runs the
following check:

	hctx->fq->flush_rq == req

but the passed hctx from bt_iter()/bt_tags_iter() may be NULL because:

1) memory re-order in blk_mq_rq_ctx_init():

	rq->mq_hctx = data->hctx;
	...
	refcount_set(&rq->ref, 1);

OR

2) tag re-use and ->rqs[] isn't updated with new request.

Fix the issue by re-writing is_flush_rq() as:

	return rq->end_io == flush_end_io;

which turns out simpler to follow and immune to data race since we have
ordered WRITE rq->end_io and refcount_set(&rq->ref, 1).

Fixes: 2e315dc07df0 ("blk-mq: grab rq->refcount before calling ->fn in
    blk_mq_tagset_busy_iter")
Cc: "Blank-Burian, Markus, Dr." <blankburian@uni-muenster.de>
Cc: Yufen Yu <yuyufen@huawei.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>.

Bug: 197804811
Change-Id: I4c19fc2c7d39235b0e95a622f26646a353a19ee9
[Upstream: cherry picked from commit a9ed27a764156929efe714033edb3e9023c5f321]
[Pradeep: Resolved conflicts in block/blk.h]
Signed-off-by: Pradeep P V K <pragalla@codeaurora.org>
Git-commit: ec1b6ab9fe
Git-repo: https://android.googlesource.com/kernel/common/
Signed-off-by: Pradeep P V K <pragalla@codeaurora.org>
2021-09-03 05:21:21 -07:00
..
partitions docs: admin-guide: add a series of orphaned documents 2019-07-15 11:03:02 -03:00
badblocks.c block: switch all files cleared marked as GPLv2 to SPDX tags 2019-04-30 16:11:57 -06:00
bfq-cgroup.c bfq: fix blkio cgroup leakage v4 2020-09-03 11:26:54 +02:00
bfq-iosched.c block: only call sched requeue_request() for scheduled requests 2020-09-23 12:40:37 +02:00
bfq-iosched.h bfq: fix blkio cgroup leakage v4 2020-09-03 11:26:54 +02:00
bfq-wf2q.c bfq: fix blkio cgroup leakage v4 2020-09-03 11:26:54 +02:00
bio-crypt-ctx.c ANDROID: dm: add dm-default-key target for metadata encryption 2020-01-24 10:52:54 -08:00
bio-integrity.c block: release bip in a right way in error path 2020-07-16 08:16:36 +02:00
bio.c Merge android11-5.4.86+ (75c93eb) into msm-5.4 2021-04-22 09:44:51 +05:30
blk-cgroup.c blk-cgroup: Pre-allocate tree node on blkg_conf_prep 2020-11-10 12:37:30 +01:00
blk-core.c This is the 5.4.73 stable release 2020-10-29 11:38:08 +01:00
blk-crypto-fallback.c ANDROID: block: require drivers to declare supported crypto key type(s) 2020-04-07 17:58:49 +00:00
blk-crypto-internal.h ANDROID: block: make blk_crypto_start_using_mode() properly check for support 2020-04-07 17:58:39 +00:00
blk-crypto.c ANDROID: block: backport the ability to specify max_dun_bytes 2020-05-15 22:01:33 +00:00
blk-exec.c block: add SPDX tags to block layer files missing licensing information 2019-04-30 16:12:03 -06:00
blk-flush.c BACKPORT: blk-mq: fix is_flush_rq 2021-09-03 05:21:21 -07:00
blk-integrity.c block: centralize PI remapping logic to the block layer 2019-09-17 20:03:49 -06:00
blk-ioc.c block: Fix use-after-free issue accessing struct io_cq 2020-04-17 10:50:04 +02:00
blk-iocost.c blk-iocost: ioc_pd_free() shouldn't assume irq disabled 2020-09-09 19:12:35 +02:00
blk-iolatency.c blkcg: s/RQ_QOS_CGROUP/RQ_QOS_LATENCY/ 2019-08-28 21:17:08 -06:00
blk-lib.c block: fix 32 bit overflow in __blkdev_issue_discard() 2018-11-14 08:17:18 -07:00
blk-map.c block: fix memleak when __blk_rq_map_user_iov() is failed 2020-01-12 12:21:43 +01:00
blk-merge.c block: fix get_max_io_size() 2020-09-28 02:54:35 -07:00
blk-mq-cpumap.c blk-mq: balance mapping between present CPUs and queues 2019-08-04 21:43:12 -06:00
blk-mq-debugfs-zoned.c block: Cleanup license notice 2019-01-17 21:21:40 -07:00
blk-mq-debugfs.c blk-mq-debugfs: update blk_queue_flag_name[] accordingly for new flags 2020-07-22 09:32:52 +02:00
blk-mq-debugfs.h blk-mq: no need to check return value of debugfs_create functions 2019-06-13 03:00:30 -06:00
blk-mq-pci.c block: Fix blk_mq_*_map_queues() kernel-doc headers 2019-05-31 15:12:34 -06:00
blk-mq-rdma.c block: Fix blk_mq_*_map_queues() kernel-doc headers 2019-05-31 15:12:34 -06:00
blk-mq-sched.c blk-mq: order adding requests to hctx->dispatch and checking SCHED_RESTART 2020-09-03 11:27:01 +02:00
blk-mq-sched.h block: only call sched requeue_request() for scheduled requests 2020-09-23 12:40:37 +02:00
blk-mq-sysfs.c blk-mq: move cancel of hctx->run_work to the front of blk_exit_queue 2020-10-29 09:57:34 +01:00
blk-mq-tag.c BACKPORT: blk-mq: clear stale request in tags->rq[] before freeing one request pool 2021-09-03 05:19:17 -07:00
blk-mq-tag.h BACKPORT: blk-mq: clear stale request in tags->rq[] before freeing one request pool 2021-09-03 05:19:17 -07:00
blk-mq-virtio.c ANDROID: modularize BLK_MQ_VIRTIO 2020-01-31 16:27:30 -08:00
blk-mq.c BACKPORT: blk-mq: fix is_flush_rq 2021-09-03 05:21:21 -07:00
blk-mq.h BACKPORT: blk-mq: grab rq->refcount before calling ->fn in blk_mq_tagset_busy_iter 2021-09-03 05:17:29 -07:00
blk-pm.c block: Fix a race in the runtime power management code 2020-08-20 12:17:49 +08:00
blk-pm.h block: remove the queue_lock indirection 2018-11-15 12:17:28 -07:00
blk-rq-qos.c blk-wbt: fix performance regression in wbt scale_up/scale_down 2019-10-06 09:26:41 -06:00
blk-rq-qos.h blk-rq-qos: fix first node deletion of rq_qos_del() 2019-10-15 10:13:13 -06:00
blk-settings.c block: keep bdi->io_pages in sync with max_sectors_kb for stacked devices 2020-04-17 10:50:01 +02:00
blk-softirq.c block: remove a few unused exports 2018-11-15 12:13:25 -07:00
blk-stat.c block: add SPDX tags to block layer files missing licensing information 2019-04-30 16:12:03 -06:00
blk-stat.h block: deactivate blk_stat timer in wbt_disable_default() 2018-12-12 06:47:51 -07:00
blk-sysfs.c blk-mq: move cancel of hctx->run_work to the front of blk_exit_queue 2020-10-29 09:57:34 +01:00
blk-throttle.c block: make rq sector size accessible for block stats 2019-09-15 16:02:08 -06:00
blk-timeout.c block: add SPDX tags to block layer files missing licensing information 2019-04-30 16:12:03 -06:00
blk-wbt.c blk-wbt: fix performance regression in wbt scale_up/scale_down 2019-10-06 09:26:41 -06:00
blk-wbt.h block/rq_qos: implement rq_qos_ops->queue_depth_changed() 2019-08-28 21:17:07 -06:00
blk-zoned.c block: Simplify REQ_OP_ZONE_RESET_ALL handling 2020-12-30 11:50:54 +01:00
blk.h BACKPORT: blk-mq: fix is_flush_rq 2021-09-03 05:21:21 -07:00
bounce.c BACKPORT: FROMLIST: Update Inline Encryption from v5 to v6 of patch series 2020-01-13 18:46:44 +00:00
bsg-lib.c block: Fix the type of 'sts' in bsg_queue_rq() 2020-01-23 08:22:44 +01:00
bsg.c block: switch all files cleared marked as GPLv2 to SPDX tags 2019-04-30 16:11:57 -06:00
cmdline-parser.c
compat_ioctl.c compat_ioctl: block: handle BLKGETZONESZ/BLKGETNRZONES 2020-01-09 10:19:58 +01:00
elevator.c Revert "block: Enable BFQ io scheduler as default" 2021-06-27 07:09:30 -07:00
genhd.c block: Delay default elevator initialization 2019-09-05 19:52:34 -06:00
ioctl.c block: simplify blkdev_nr_zones 2020-01-07 16:02:49 -08:00
ioprio.c docs: block: convert to ReST 2019-07-15 09:20:27 -03:00
Kconfig ANDROID: modularize BLK_MQ_VIRTIO 2020-01-31 16:27:30 -08:00
Kconfig.iosched docs: block: convert to ReST 2019-07-15 09:20:27 -03:00
keyslot-manager.c ANDROID: block: backport the ability to specify max_dun_bytes 2020-05-15 22:01:33 +00:00
kyber-iosched.c blk-mq: remove blk_mq_put_ctx() 2019-07-02 21:03:27 -06:00
Makefile BACKPORT: FROMLIST: Update Inline Encryption from v5 to v6 of patch series 2020-01-13 18:46:44 +00:00
mq-deadline.c block: Introduce elevator features 2019-09-05 19:52:33 -06:00
opal_proto.h block: sed-opal: Removed duplicate OPAL_METHOD_LENGTH definition 2019-08-20 09:34:49 -06:00
OWNERS ANDROID: Add OWNERS files referring to the respective android-mainline OWNERS 2021-04-01 13:45:14 +00:00
partition-generic.c block: Remove partition support for zoned block devices 2020-01-07 16:02:46 -08:00
scsi_ioctl.c block: switch all files cleared marked as GPLv2 to SPDX tags 2019-04-30 16:11:57 -06:00
sed-opal.c block: sed-opal: fix sparse warning: convert __be64 data 2019-10-03 14:21:32 -06:00
t10-pi.c block: t10-pi: fix -Wswitch warning 2019-09-23 08:05:19 -06:00