android_kernel_motorola_sm6225/block
Ming Lei 09de4ca5ab 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: ec1b6ab9fe80cf689780c9ee3b2cdb04cc11895e
Git-repo: https://android.googlesource.com/kernel/common/
Signed-off-by: Pradeep P V K <quic_pragalla@quicinc.com>
(cherry picked from commit 49724e13eb)

Change-Id: I866184c8fb0d5708fc582c1aff0c4084a911a291
Signed-off-by: Surapusetty Naresh Babu <snareshb@qti.qualcomm.com>
2023-11-06 03:00:13 -08:00
..
partitions
badblocks.c
bfq-cgroup.c block, bfq: fix overwrite of bfq_group pointer in bfq_find_set_group() 2020-03-25 08:06:08 +01:00
bfq-iosched.c block, bfq: fix use-after-free in bfq_idle_slice_timer_body 2020-04-17 10:48:42 +02:00
bfq-iosched.h block, bfq: inject other-queue I/O into seeky idle queues on NCQ flash 2019-11-20 18:46:44 +01:00
bfq-wf2q.c
bio-crypt-ctx.c File and metadata encryption changes from android-4.19.96-107 2020-04-21 06:19:04 -07:00
bio-integrity.c block: release bip in a right way in error path 2020-07-16 08:17:23 +02:00
bio.c Revert existing FBE changes for ICE FBE 2020-04-24 15:19:09 -07:00
blk-cgroup.c blk-cgroup: Pre-allocate tree node on blkg_conf_prep 2020-11-10 12:35:59 +01:00
blk-core.c block: ratelimit handle_bad_sector() message 2023-09-13 15:02:56 +05:30
blk-crypto-fallback.c ANDROID: block: require drivers to declare supported crypto key type(s) 2020-07-08 10:19:08 -07:00
blk-crypto-internal.h ANDROID: block: make blk_crypto_start_using_mode() properly check for support 2020-07-08 10:18:54 -07:00
blk-crypto.c ANDROID: block: backport the ability to specify max_dun_bytes 2020-07-19 14:32:24 +05:30
blk-exec.c
blk-flush.c BACKPORT: blk-mq: fix is_flush_rq 2023-11-06 03:00:13 -08:00
blk-integrity.c
blk-ioc.c block: Fix use-after-free issue accessing struct io_cq 2020-04-17 10:48:41 +02:00
blk-iolatency.c
blk-lib.c block: fix 32 bit overflow in __blkdev_issue_discard() 2020-02-01 09:37:12 +00:00
blk-map.c block: fix memleak when __blk_rq_map_user_iov() is failed 2020-01-12 12:17:22 +01:00
blk-merge.c Merge android-4.19.110 (1984fff) into msm-4.19 2020-05-23 05:08:22 -07:00
blk-mq-cpumap.c
blk-mq-debugfs-zoned.c
blk-mq-debugfs.c
blk-mq-debugfs.h
blk-mq-pci.c
blk-mq-rdma.c
blk-mq-sched.c blk-mq: order adding requests to hctx->dispatch and checking SCHED_RESTART 2020-09-03 11:24:26 +02:00
blk-mq-sched.h
blk-mq-sysfs.c blk-mq: make sure that line break can be printed 2019-12-17 20:35:48 +01:00
blk-mq-tag.c BACKPORT: blk-mq: clear stale request in tags->rq[] before freeing one request pool 2023-11-06 02:30:55 -08:00
blk-mq-tag.h BACKPORT: blk-mq: clear stale request in tags->rq[] before freeing one request pool 2023-11-06 02:30:55 -08:00
blk-mq-virtio.c ANDROID: modularize BLK_MQ_VIRTIO 2020-01-31 16:11:59 -08:00
blk-mq.c BACKPORT: blk-mq: fix is_flush_rq 2023-11-06 03:00:13 -08:00
blk-mq.h BACKPORT: blk-mq: grab rq->refcount before calling ->fn in blk_mq_tagset_busy_iter 2023-11-05 23:23:35 -08:00
blk-rq-qos.c blk-wbt: fix performance regression in wbt scale_up/scale_down 2019-10-17 13:45:16 -07:00
blk-rq-qos.h blk-rq-qos: fix first node deletion of rq_qos_del() 2019-10-29 09:20:09 +01:00
blk-settings.c block: keep bdi->io_pages in sync with max_sectors_kb for stacked devices 2020-04-17 10:48:39 +02:00
blk-softirq.c
blk-stat.c
blk-stat.h
blk-sysfs.c block: call rq_qos_exit() after queue is frozen 2019-12-01 09:17:06 +01:00
blk-tag.c
blk-throttle.c
blk-timeout.c
blk-wbt.c blk-wbt: fix performance regression in wbt scale_up/scale_down 2019-10-17 13:45:16 -07:00
blk-wbt.h
blk-zoned.c
blk.h BACKPORT: blk-mq: fix is_flush_rq 2023-11-06 03:00:13 -08:00
bounce.c Revert existing FBE changes for ICE FBE 2020-04-24 15:19:09 -07:00
bsg-lib.c
bsg.c
cfq-iosched.c
cmdline-parser.c
compat_ioctl.c compat_ioctl: block: handle BLKREPORTZONE/BLKRESETZONE 2020-01-09 10:19:01 +01:00
deadline-iosched.c
elevator.c block: pm: Fix possible unbalanced nr_pending 2021-09-15 09:44:27 +08:00
genhd.c
ioctl.c
ioprio.c
Kconfig File and metadata encryption changes from android-4.19.96-107 2020-04-21 06:19:04 -07:00
Kconfig.iosched
keyslot-manager.c ANDROID: block: backport the ability to specify max_dun_bytes 2020-07-19 14:32:24 +05:30
kyber-iosched.c
Makefile File and metadata encryption changes from android-4.19.96-107 2020-04-21 06:19:04 -07:00
mq-deadline.c
noop-iosched.c
opal_proto.h
partition-generic.c
scsi_ioctl.c
sed-opal.c
t10-pi.c