All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] blkcg: add a cleanup when active policy fail
@ 2017-08-21 15:12 weiping zhang
  0 siblings, 0 replies; only message in thread
From: weiping zhang @ 2017-08-21 15:12 UTC (permalink / raw)
  To: axboe; +Cc: linux-block

if alloc memory fail, all cpds which were allocated before should be cleaned up.

Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
---
 block/blk-cgroup.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 0480892..7e21c4b 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1336,6 +1336,17 @@ int blkcg_activate_policy(struct request_queue *q,
 
 	spin_unlock_irq(q->queue_lock);
 out_bypass_end:
+	if (ret) {
+		spin_lock_irq(q->queue_lock);
+		list_for_each_entry(blkg, &q->blkg_list, q_node) {
+			if (blkg->pd[pol->plid]) {
+				if (pol->pd_free_fn)
+					pol->pd_free_fn(blkg->pd[pol->plid]);
+				blkg->pd[pol->plid] = NULL;
+			}
+		}
+		spin_unlock_irq(q->queue_lock);
+	}
 	if (q->mq_ops)
 		blk_mq_unfreeze_queue(q);
 	else
-- 
2.9.4

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-08-21 15:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-21 15:12 [PATCH] blkcg: add a cleanup when active policy fail weiping zhang

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.