+++ /dev/null
-From 4bdbbcc2e8b0a8b4983e3561756907fffb9d9997 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 24 Jun 2020 16:00:58 -0400
-Subject: dm: do not use waitqueue for request-based DM
-
-From: Ming Lei <ming.lei@redhat.com>
-
-[ Upstream commit 85067747cf9888249fa11fa49ef75af5192d3988 ]
-
-Given request-based DM now uses blk-mq's blk_mq_queue_inflight() to
-determine if outstanding IO has completed (and DM has no control over
-the blk-mq state machine used to track outstanding IO) it is unsafe to
-wakeup waiter (dm_wait_for_completion) before blk-mq has cleared a
-request's state bits (e.g. MQ_RQ_IN_FLIGHT or MQ_RQ_COMPLETE). As
-such dm_wait_for_completion() could be left to wait indefinitely if no
-other requests complete.
-
-Fix this by eliminating request-based DM's use of waitqueue to wait
-for blk-mq requests to complete in dm_wait_for_completion.
-
-Signed-off-by: Ming Lei <ming.lei@redhat.com>
-Depends-on: 3c94d83cb3526 ("blk-mq: change blk_mq_queue_busy() to blk_mq_queue_inflight()")
-Cc: stable@vger.kernel.org
-Signed-off-by: Mike Snitzer <snitzer@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/md/dm-rq.c | 4 ---
- drivers/md/dm.c | 64 ++++++++++++++++++++++++++++------------------
- 2 files changed, 39 insertions(+), 29 deletions(-)
-
-diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c
-index 3f8577e2c13be..9fb46a6301d80 100644
---- a/drivers/md/dm-rq.c
-+++ b/drivers/md/dm-rq.c
-@@ -146,10 +146,6 @@ static void rq_end_stats(struct mapped_device *md, struct request *orig)
- */
- static void rq_completed(struct mapped_device *md)
- {
-- /* nudge anyone waiting on suspend queue */
-- if (unlikely(wq_has_sleeper(&md->wait)))
-- wake_up(&md->wait);
--
- /*
- * dm_put() must be at the end of this function. See the comment above
- */
-diff --git a/drivers/md/dm.c b/drivers/md/dm.c
-index 1e7ad2ad48295..87319c473594a 100644
---- a/drivers/md/dm.c
-+++ b/drivers/md/dm.c
-@@ -627,28 +627,6 @@ static void free_tio(struct dm_target_io *tio)
- bio_put(&tio->clone);
- }
-
--static bool md_in_flight_bios(struct mapped_device *md)
--{
-- int cpu;
-- struct hd_struct *part = &dm_disk(md)->part0;
-- long sum = 0;
--
-- for_each_possible_cpu(cpu) {
-- sum += part_stat_local_read_cpu(part, in_flight[0], cpu);
-- sum += part_stat_local_read_cpu(part, in_flight[1], cpu);
-- }
--
-- return sum != 0;
--}
--
--static bool md_in_flight(struct mapped_device *md)
--{
-- if (queue_is_mq(md->queue))
-- return blk_mq_queue_inflight(md->queue);
-- else
-- return md_in_flight_bios(md);
--}
--
- u64 dm_start_time_ns_from_clone(struct bio *bio)
- {
- struct dm_target_io *tio = container_of(bio, struct dm_target_io, clone);
-@@ -2439,15 +2417,29 @@ void dm_put(struct mapped_device *md)
- }
- EXPORT_SYMBOL_GPL(dm_put);
-
--static int dm_wait_for_completion(struct mapped_device *md, long task_state)
-+static bool md_in_flight_bios(struct mapped_device *md)
-+{
-+ int cpu;
-+ struct hd_struct *part = &dm_disk(md)->part0;
-+ long sum = 0;
-+
-+ for_each_possible_cpu(cpu) {
-+ sum += part_stat_local_read_cpu(part, in_flight[0], cpu);
-+ sum += part_stat_local_read_cpu(part, in_flight[1], cpu);
-+ }
-+
-+ return sum != 0;
-+}
-+
-+static int dm_wait_for_bios_completion(struct mapped_device *md, long task_state)
- {
- int r = 0;
- DEFINE_WAIT(wait);
-
-- while (1) {
-+ while (true) {
- prepare_to_wait(&md->wait, &wait, task_state);
-
-- if (!md_in_flight(md))
-+ if (!md_in_flight_bios(md))
- break;
-
- if (signal_pending_state(task_state, current)) {
-@@ -2462,6 +2454,28 @@ static int dm_wait_for_completion(struct mapped_device *md, long task_state)
- return r;
- }
-
-+static int dm_wait_for_completion(struct mapped_device *md, long task_state)
-+{
-+ int r = 0;
-+
-+ if (!queue_is_mq(md->queue))
-+ return dm_wait_for_bios_completion(md, task_state);
-+
-+ while (true) {
-+ if (!blk_mq_queue_inflight(md->queue))
-+ break;
-+
-+ if (signal_pending_state(task_state, current)) {
-+ r = -EINTR;
-+ break;
-+ }
-+
-+ msleep(5);
-+ }
-+
-+ return r;
-+}
-+
- /*
- * Process the deferred bios
- */
---
-2.25.1
-
arm-dts-imx6qdl-gw551x-fix-audio-ssi.patch
dmabuf-use-spinlock-to-access-dmabuf-name.patch
drm-amd-display-check-dmcu-exists-before-loading.patch
-dm-do-not-use-waitqueue-for-request-based-dm.patch
sunrpc-reverting-d03727b248d0-nfsv4-fix-close-not-waiting-for-direct-io-compeletion.patch
btrfs-reloc-fix-reloc-root-leak-and-null-pointer-dereference.patch
btrfs-reloc-clear-dead_reloc_tree-bit-for-orphan-roots-to-prevent-runaway-balance.patch
+++ /dev/null
-From 1566f5675a1fed592c963cdcc3786a1983eeb7d2 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 24 Jun 2020 16:00:58 -0400
-Subject: dm: do not use waitqueue for request-based DM
-
-From: Ming Lei <ming.lei@redhat.com>
-
-[ Upstream commit 85067747cf9888249fa11fa49ef75af5192d3988 ]
-
-Given request-based DM now uses blk-mq's blk_mq_queue_inflight() to
-determine if outstanding IO has completed (and DM has no control over
-the blk-mq state machine used to track outstanding IO) it is unsafe to
-wakeup waiter (dm_wait_for_completion) before blk-mq has cleared a
-request's state bits (e.g. MQ_RQ_IN_FLIGHT or MQ_RQ_COMPLETE). As
-such dm_wait_for_completion() could be left to wait indefinitely if no
-other requests complete.
-
-Fix this by eliminating request-based DM's use of waitqueue to wait
-for blk-mq requests to complete in dm_wait_for_completion.
-
-Signed-off-by: Ming Lei <ming.lei@redhat.com>
-Depends-on: 3c94d83cb3526 ("blk-mq: change blk_mq_queue_busy() to blk_mq_queue_inflight()")
-Cc: stable@vger.kernel.org
-Signed-off-by: Mike Snitzer <snitzer@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/md/dm-rq.c | 4 ---
- drivers/md/dm.c | 64 ++++++++++++++++++++++++++++------------------
- 2 files changed, 39 insertions(+), 29 deletions(-)
-
-diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c
-index 3f8577e2c13be..9fb46a6301d80 100644
---- a/drivers/md/dm-rq.c
-+++ b/drivers/md/dm-rq.c
-@@ -146,10 +146,6 @@ static void rq_end_stats(struct mapped_device *md, struct request *orig)
- */
- static void rq_completed(struct mapped_device *md)
- {
-- /* nudge anyone waiting on suspend queue */
-- if (unlikely(wq_has_sleeper(&md->wait)))
-- wake_up(&md->wait);
--
- /*
- * dm_put() must be at the end of this function. See the comment above
- */
-diff --git a/drivers/md/dm.c b/drivers/md/dm.c
-index cefda95c9abb7..e70f22d7874fa 100644
---- a/drivers/md/dm.c
-+++ b/drivers/md/dm.c
-@@ -654,28 +654,6 @@ static void free_tio(struct dm_target_io *tio)
- bio_put(&tio->clone);
- }
-
--static bool md_in_flight_bios(struct mapped_device *md)
--{
-- int cpu;
-- struct hd_struct *part = &dm_disk(md)->part0;
-- long sum = 0;
--
-- for_each_possible_cpu(cpu) {
-- sum += part_stat_local_read_cpu(part, in_flight[0], cpu);
-- sum += part_stat_local_read_cpu(part, in_flight[1], cpu);
-- }
--
-- return sum != 0;
--}
--
--static bool md_in_flight(struct mapped_device *md)
--{
-- if (queue_is_mq(md->queue))
-- return blk_mq_queue_inflight(md->queue);
-- else
-- return md_in_flight_bios(md);
--}
--
- u64 dm_start_time_ns_from_clone(struct bio *bio)
- {
- struct dm_target_io *tio = container_of(bio, struct dm_target_io, clone);
-@@ -2447,15 +2425,29 @@ void dm_put(struct mapped_device *md)
- }
- EXPORT_SYMBOL_GPL(dm_put);
-
--static int dm_wait_for_completion(struct mapped_device *md, long task_state)
-+static bool md_in_flight_bios(struct mapped_device *md)
-+{
-+ int cpu;
-+ struct hd_struct *part = &dm_disk(md)->part0;
-+ long sum = 0;
-+
-+ for_each_possible_cpu(cpu) {
-+ sum += part_stat_local_read_cpu(part, in_flight[0], cpu);
-+ sum += part_stat_local_read_cpu(part, in_flight[1], cpu);
-+ }
-+
-+ return sum != 0;
-+}
-+
-+static int dm_wait_for_bios_completion(struct mapped_device *md, long task_state)
- {
- int r = 0;
- DEFINE_WAIT(wait);
-
-- while (1) {
-+ while (true) {
- prepare_to_wait(&md->wait, &wait, task_state);
-
-- if (!md_in_flight(md))
-+ if (!md_in_flight_bios(md))
- break;
-
- if (signal_pending_state(task_state, current)) {
-@@ -2470,6 +2462,28 @@ static int dm_wait_for_completion(struct mapped_device *md, long task_state)
- return r;
- }
-
-+static int dm_wait_for_completion(struct mapped_device *md, long task_state)
-+{
-+ int r = 0;
-+
-+ if (!queue_is_mq(md->queue))
-+ return dm_wait_for_bios_completion(md, task_state);
-+
-+ while (true) {
-+ if (!blk_mq_queue_inflight(md->queue))
-+ break;
-+
-+ if (signal_pending_state(task_state, current)) {
-+ r = -EINTR;
-+ break;
-+ }
-+
-+ msleep(5);
-+ }
-+
-+ return r;
-+}
-+
- /*
- * Process the deferred bios
- */
---
-2.25.1
-
drm-nouveau-nouveau-fix-page-fault-on-device-private.patch
drm-amd-display-check-dmcu-exists-before-loading.patch
drm-amd-display-add-dmcub-check-on-renoir.patch
-dm-do-not-use-waitqueue-for-request-based-dm.patch
sunrpc-reverting-d03727b248d0-nfsv4-fix-close-not-waiting-for-direct-io-compeletion.patch
exfat-fix-overflow-issue-in-exfat_cluster_to_sector.patch
exfat-fix-wrong-hint_stat-initialization-in-exfat_find_dir_entry.patch