cgroup: cgroup_idr_lock should be bh
authorTejun Heo <tj@kernel.org>
Tue, 13 May 2014 16:10:59 +0000 (12:10 -0400)
committerTejun Heo <tj@kernel.org>
Tue, 13 May 2014 16:10:59 +0000 (12:10 -0400)
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: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
kernel/cgroup.c

index 95fc66b16091dfc2c335eb4de0b3564c961d46d1..e2ff925e6ee876f6ec4bb1e81bf404e4111275f7 100644 (file)
@@ -203,9 +203,9 @@ static int cgroup_idr_alloc(struct idr *idr, void *ptr, int start, int end,
        int ret;
 
        idr_preload(gfp_mask);
-       spin_lock(&cgroup_idr_lock);
+       spin_lock_bh(&cgroup_idr_lock);
        ret = idr_alloc(idr, ptr, start, end, gfp_mask);
-       spin_unlock(&cgroup_idr_lock);
+       spin_unlock_bh(&cgroup_idr_lock);
        idr_preload_end();
        return ret;
 }
@@ -214,17 +214,17 @@ static void *cgroup_idr_replace(struct idr *idr, void *ptr, int id)
 {
        void *ret;
 
-       spin_lock(&cgroup_idr_lock);
+       spin_lock_bh(&cgroup_idr_lock);
        ret = idr_replace(idr, ptr, id);
-       spin_unlock(&cgroup_idr_lock);
+       spin_unlock_bh(&cgroup_idr_lock);
        return ret;
 }
 
 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);
-       spin_unlock(&cgroup_idr_lock);
+       spin_unlock_bh(&cgroup_idr_lock);
 }
 
 /**