[PATCH] blkcg: add a cleanup when active policy fail

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: weiping zhang <zhangweiping@xxxxxxxxxxxxxxx>
---
 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




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux