Skip to contentSkip to conversation

blk-cgroup: fix wrong unlock order when parse per blkg config

PATCH In review Joseph Qi 2 participants 4 messages Apr 24, 2017 – May 2, 2017 3 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

Joseph Qi

author
#0 lore raw

PATCH 1/1 blk-cgroup: fix wrong unlock order when parse per blkg config

From: Joseph Qi <[email protected]>

In case of error blkg in blkg_conf_prep, we should unlock queue->queue_lock first and then rcu, just like blkg_conf_finish.

---
 block/blk-cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-cgroup.c +1 -1
index bbe7ee0..cc017b2 100644
@@ -823,8 +823,8 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
 
 	if (IS_ERR(blkg)) {
 		ret = PTR_ERR(blkg);
-		rcu_read_unlock();
 		spin_unlock_irq(disk->queue->queue_lock);
+		rcu_read_unlock();
 		owner = disk->fops->owner;
 		put_disk(disk);
 		module_put(owner);
Signature · 1 line
1.9.4
#2 lore raw
In reply to a message not in the archive

Hello,

Quoted 4 lines · Joseph Qi

From: Joseph Qi <[email protected]>

In case of error blkg in blkg_conf_prep, we should unlock queue->queue_lock first and then rcu, just like blkg_conf_finish.

I get that this is inconsistent but why is this wrong? If this is for consistency, can you please explain so in the commit so that people don't confuse it for an actual bug fix?

Thanks.

Signature · 1 line
tejun
author
#4 lore raw
In reply to a message not in the archive

Fine, I will explain so and resend it later.

Thanks,
Joseph

Quoted 14 lines · Tejun Heo

Hello,

Quoted 4 lines · Joseph Qi

From: Joseph Qi <[email protected]>

In case of error blkg in blkg_conf_prep, we should unlock queue->queue_lock first and then rcu, just like blkg_conf_finish.

I get that this is inconsistent but why is this wrong? If this is for consistency, can you please explain so in the commit so that people don't confuse it for an actual bug fix?

Thanks.

author
#6 lore raw
In reply to a message not in the archive

Hi Tejun,

I've checked the upstream mainline and found that this is already fixed as part of your commit 457e490f2b74 ("blkcg: allocate struct blkcg_gq outside request queue spinlock"). So I do not have to resend it any more, thanks.

Thanks,
Joseph

Quoted 20 lines · Joseph Qi

Fine, I will explain so and resend it later.

Thanks,
Joseph

Quoted 14 lines · Tejun Heo

Hello,

Quoted 4 lines · Joseph Qi

From: Joseph Qi <[email protected]>

In case of error blkg in blkg_conf_prep, we should unlock queue->queue_lock first and then rcu, just like blkg_conf_finish.

I get that this is inconsistent but why is this wrong? If this is for consistency, can you please explain so in the commit so that people don't confuse it for an actual bug fix?

Thanks.