提交 54504e97 编写于 作者: T Tejun Heo

cgroup: cgroup_idr_lock should be bh

cgroup_idr_remove() can be invoked from bh leading to lockdep
detecting possible AA deadlock (IN_BH/ON_BH).  Make the lock bh-safe.
Signed-off-by: NTejun Heo <tj@kernel.org>
Acked-by: NLi Zefan <lizefan@huawei.com>
上级 0cee8b77
...@@ -203,9 +203,9 @@ static int cgroup_idr_alloc(struct idr *idr, void *ptr, int start, int end, ...@@ -203,9 +203,9 @@ static int cgroup_idr_alloc(struct idr *idr, void *ptr, int start, int end,
int ret; int ret;
idr_preload(gfp_mask); idr_preload(gfp_mask);
spin_lock(&cgroup_idr_lock); spin_lock_bh(&cgroup_idr_lock);
ret = idr_alloc(idr, ptr, start, end, gfp_mask); ret = idr_alloc(idr, ptr, start, end, gfp_mask);
spin_unlock(&cgroup_idr_lock); spin_unlock_bh(&cgroup_idr_lock);
idr_preload_end(); idr_preload_end();
return ret; return ret;
} }
...@@ -214,17 +214,17 @@ static void *cgroup_idr_replace(struct idr *idr, void *ptr, int id) ...@@ -214,17 +214,17 @@ static void *cgroup_idr_replace(struct idr *idr, void *ptr, int id)
{ {
void *ret; void *ret;
spin_lock(&cgroup_idr_lock); spin_lock_bh(&cgroup_idr_lock);
ret = idr_replace(idr, ptr, id); ret = idr_replace(idr, ptr, id);
spin_unlock(&cgroup_idr_lock); spin_unlock_bh(&cgroup_idr_lock);
return ret; return ret;
} }
static void cgroup_idr_remove(struct idr *idr, int id) static void cgroup_idr_remove(struct idr *idr, int id)
{ {
spin_lock(&cgroup_idr_lock); spin_lock_bh(&cgroup_idr_lock);
idr_remove(idr, id); idr_remove(idr, id);
spin_unlock(&cgroup_idr_lock); spin_unlock_bh(&cgroup_idr_lock);
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册