All of lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND][PATCH v2] cfq: clear queue pointers from cfqg after unpinning them in cfq_pd_offline
@ 2018-10-10 21:16 Maciej S. Szmigiero
  2018-10-11 17:46 ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Maciej S. Szmigiero @ 2018-10-10 21:16 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Caspar Zhang, jiufei.xue, Tejun Heo, Joseph Qi, linux-kernel,
	linux-block

BFQ is already doing a similar thing in its .pd_offline_fn() method
implementation.

While it seems that after commit 4c6994806f70
("blk-throttle: fix race between blkcg_bio_issue_check() and cgroup_rmdir()")
was reverted leaving these pointers intact no longer causes crashes
clearing them is still a sensible thing to do to make the code more robust.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
---
Changes from v1: Drop stable and fixes tags, rewrite the commit message
as after commit 4c6994806f70 was reverted this change is no longer
required to fix a crash.

 block/cfq-iosched.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index d219e9a1af65..6a3d87dd3c1a 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1644,14 +1644,20 @@ static void cfq_pd_offline(struct blkg_policy_data *pd)
 	int i;
 
 	for (i = 0; i < IOPRIO_BE_NR; i++) {
-		if (cfqg->async_cfqq[0][i])
+		if (cfqg->async_cfqq[0][i]) {
 			cfq_put_queue(cfqg->async_cfqq[0][i]);
-		if (cfqg->async_cfqq[1][i])
+			cfqg->async_cfqq[0][i] = NULL;
+		}
+		if (cfqg->async_cfqq[1][i]) {
 			cfq_put_queue(cfqg->async_cfqq[1][i]);
+			cfqg->async_cfqq[1][i] = NULL;
+		}
 	}
 
-	if (cfqg->async_idle_cfqq)
+	if (cfqg->async_idle_cfqq) {
 		cfq_put_queue(cfqg->async_idle_cfqq);
+		cfqg->async_idle_cfqq = NULL;
+	}
 
 	/*
 	 * @blkg is going offline and will be ignored by
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RESEND][PATCH v2] cfq: clear queue pointers from cfqg after unpinning them in cfq_pd_offline
  2018-10-10 21:16 [RESEND][PATCH v2] cfq: clear queue pointers from cfqg after unpinning them in cfq_pd_offline Maciej S. Szmigiero
@ 2018-10-11 17:46 ` Jens Axboe
  0 siblings, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2018-10-11 17:46 UTC (permalink / raw)
  To: Maciej S. Szmigiero
  Cc: Caspar Zhang, jiufei.xue, Tejun Heo, Joseph Qi, linux-kernel,
	linux-block

On 10/10/18 3:16 PM, Maciej S. Szmigiero wrote:
> BFQ is already doing a similar thing in its .pd_offline_fn() method
> implementation.
> 
> While it seems that after commit 4c6994806f70
> ("blk-throttle: fix race between blkcg_bio_issue_check() and cgroup_rmdir()")
> was reverted leaving these pointers intact no longer causes crashes
> clearing them is still a sensible thing to do to make the code more robust.

Applied, thanks.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [RESEND][PATCH v2] cfq: clear queue pointers from cfqg after unpinning them in cfq_pd_offline
@ 2018-09-19 21:58 Maciej S. Szmigiero
  0 siblings, 0 replies; 3+ messages in thread
From: Maciej S. Szmigiero @ 2018-09-19 21:58 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, linux-kernel, Joseph Qi, Tejun Heo, jiufei.xue,
	Caspar Zhang

BFQ is already doing a similar thing in its .pd_offline_fn() method
implementation.

While it seems that after
commit 4c6994806f70 ("blk-throttle: fix race between blkcg_bio_issue_check() and cgroup_rmdir()")
was reverted leaving these pointers intact no longer causes crashes
clearing them is still a sensible thing to do to make the code more robust.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
---
Changes from v1: Drop stable and fixes tags, rewrite the commit message
as after commit 4c6994806f70 was reverted this change is no longer
required to fix a crash.

 block/cfq-iosched.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 2eb87444b157..ed41aa978c4a 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1644,14 +1644,20 @@ static void cfq_pd_offline(struct blkg_policy_data *pd)
 	int i;
 
 	for (i = 0; i < IOPRIO_BE_NR; i++) {
-		if (cfqg->async_cfqq[0][i])
+		if (cfqg->async_cfqq[0][i]) {
 			cfq_put_queue(cfqg->async_cfqq[0][i]);
-		if (cfqg->async_cfqq[1][i])
+			cfqg->async_cfqq[0][i] = NULL;
+		}
+		if (cfqg->async_cfqq[1][i]) {
 			cfq_put_queue(cfqg->async_cfqq[1][i]);
+			cfqg->async_cfqq[1][i] = NULL;
+		}
 	}
 
-	if (cfqg->async_idle_cfqq)
+	if (cfqg->async_idle_cfqq) {
 		cfq_put_queue(cfqg->async_idle_cfqq);
+		cfqg->async_idle_cfqq = NULL;
+	}
 
 	/*
 	 * @blkg is going offline and will be ignored by

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-10-11 17:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-10 21:16 [RESEND][PATCH v2] cfq: clear queue pointers from cfqg after unpinning them in cfq_pd_offline Maciej S. Szmigiero
2018-10-11 17:46 ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2018-09-19 21:58 Maciej S. Szmigiero

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.