From 6c6f27531fdde64e62b1a94c261cdcea8ca22f72 Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Fri, 26 Apr 2013 08:45:12 -0400 Subject: [PATCH] Add patch to prevent scheduling while atomic error in blkcg --- ...ile-atomic-in-blk_queue_bypass_start.patch | 79 +++++++++++++++++++ kernel.spec | 7 ++ 2 files changed, 86 insertions(+) create mode 100644 blkcg-fix-scheduling-while-atomic-in-blk_queue_bypass_start.patch diff --git a/blkcg-fix-scheduling-while-atomic-in-blk_queue_bypass_start.patch b/blkcg-fix-scheduling-while-atomic-in-blk_queue_bypass_start.patch new file mode 100644 index 000000000..615d7555b --- /dev/null +++ b/blkcg-fix-scheduling-while-atomic-in-blk_queue_bypass_start.patch @@ -0,0 +1,79 @@ +From e5072664f8237cf53b0bd68a51aa1a7bc69061c5 Mon Sep 17 00:00:00 2001 +From: Jun'ichi Nomura +Date: Tue, 09 Apr 2013 13:01:21 +0000 +Subject: blkcg: fix "scheduling while atomic" in blk_queue_bypass_start + +Since 749fefe677 in v3.7 ("block: lift the initial queue bypass mode +on blk_register_queue() instead of blk_init_allocated_queue()"), +the following warning appears when multipath is used with CONFIG_PREEMPT=y. + +This patch moves blk_queue_bypass_start() before radix_tree_preload() +to avoid the sleeping call while preemption is disabled. + + BUG: scheduling while atomic: multipath/2460/0x00000002 + 1 lock held by multipath/2460: + #0: (&md->type_lock){......}, at: [] dm_lock_md_type+0x17/0x19 [dm_mod] + Modules linked in: ... + Pid: 2460, comm: multipath Tainted: G W 3.7.0-rc2 #1 + Call Trace: + [] __schedule_bug+0x6a/0x78 + [] __schedule+0xb4/0x5e0 + [] schedule+0x64/0x66 + [] schedule_timeout+0x39/0xf8 + [] ? put_lock_stats+0xe/0x29 + [] ? lock_release_holdtime+0xb6/0xbb + [] wait_for_common+0x9d/0xee + [] ? try_to_wake_up+0x206/0x206 + [] ? kfree_call_rcu+0x1c/0x1c + [] wait_for_completion+0x1d/0x1f + [] wait_rcu_gp+0x5d/0x7a + [] ? wait_rcu_gp+0x7a/0x7a + [] ? complete+0x21/0x53 + [] synchronize_rcu+0x1e/0x20 + [] blk_queue_bypass_start+0x5d/0x62 + [] blkcg_activate_policy+0x73/0x270 + [] ? kmem_cache_alloc_node_trace+0xc7/0x108 + [] cfq_init_queue+0x80/0x28e + [] ? dm_blk_ioctl+0xa7/0xa7 [dm_mod] + [] elevator_init+0xe1/0x115 + [] ? blk_queue_make_request+0x54/0x59 + [] blk_init_allocated_queue+0x8c/0x9e + [] dm_setup_md_queue+0x36/0xaa [dm_mod] + [] table_load+0x1bd/0x2c8 [dm_mod] + [] ctl_ioctl+0x1d6/0x236 [dm_mod] + [] ? table_clear+0xaa/0xaa [dm_mod] + [] dm_ctl_ioctl+0x13/0x17 [dm_mod] + [] do_vfs_ioctl+0x3fb/0x441 + [] ? file_has_perm+0x8a/0x99 + [] sys_ioctl+0x5e/0x82 + [] ? trace_hardirqs_on_thunk+0x3a/0x3f + [] system_call_fastpath+0x16/0x1b + +Signed-off-by: Jun'ichi Nomura +Acked-by: Vivek Goyal +Acked-by: Tejun Heo +Cc: Alasdair G Kergon +Cc: stable@kernel.org +Signed-off-by: Jens Axboe +--- +(limited to 'block/blk-cgroup.c') + +diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c +index b2b9837..e8918ff 100644 +--- a/block/blk-cgroup.c ++++ b/block/blk-cgroup.c +@@ -972,10 +972,10 @@ int blkcg_activate_policy(struct request_queue *q, + if (!new_blkg) + return -ENOMEM; + +- preloaded = !radix_tree_preload(GFP_KERNEL); +- + blk_queue_bypass_start(q); + ++ preloaded = !radix_tree_preload(GFP_KERNEL); ++ + /* + * Make sure the root blkg exists and count the existing blkgs. As + * @q is bypassing at this point, blkg_lookup_create() can't be +-- +cgit v0.9.1 diff --git a/kernel.spec b/kernel.spec index 7ea5d7901..84f186fce 100644 --- a/kernel.spec +++ b/kernel.spec @@ -758,6 +758,8 @@ Patch25012: events-protect-access-via-task-subsys-state-check.patch #rhbz 953447 Patch25013: efi-Check-EFI-revision-in-setup_efi_vars.patch +Patch25014: blkcg-fix-scheduling-while-atomic-in-blk_queue_bypass_start.patch + # END OF PATCH DEFINITIONS %endif @@ -1465,6 +1467,8 @@ ApplyPatch events-protect-access-via-task-subsys-state-check.patch #rhbz 953447 ApplyPatch efi-Check-EFI-revision-in-setup_efi_vars.patch +ApplyPatch blkcg-fix-scheduling-while-atomic-in-blk_queue_bypass_start.patch + # END OF PATCH APPLICATIONS %endif @@ -2298,6 +2302,9 @@ fi # ||----w | # || || %changelog +* Fri Apr 26 2013 Josh Boyer +- Add patch to prevent scheduling while atomic error in blkcg + * Wed Apr 24 2013 Josh Boyer - Add patch to fix EFI boot on Macs (rhbz 953447)