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

A message that is not in the archive (sent off-list or not yet received): be8d9709-84fe-d2df-f294-a12701675e27-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw

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

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#4 lore raw

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.

A message that is not in the archive (sent off-list or not yet received): c39a752d-034e-02a0-3c46-892e42c6616a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

author
#6 lore raw

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.