LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   blkio crashes at rmdir when using fork (https://www.linuxquestions.org/questions/linux-kernel-70/blkio-crashes-at-rmdir-when-using-fork-892937/)

alephan 07-21-2011 07:49 AM

blkio crashes at rmdir when using fork
 
Hello to all.

I have a simple code:

[...]
1. Mount blkio
2. Create 2 subgroups: test1 test2 in blkio cgroup
3. Fork()
child:
puts his pid in test1/task
writes 500 in test1/blkio.weight
does a dd
parent:
puts his pid in test2/task
writes 500 in test1/blkio.weight
does a dd

Everything works ok as expected using blkio.weight file variable.

The problem is that when everything is done, the bash command:
rmdir cgroup/test1 dies like:
Code:

[  664.087694] Unable to handle kernel paging request at virtual address 4ff60bec
[  664.102142] pgd = 9a128000
[  664.107583] [4ff60bec] *pgd=00000000
[  664.114719] Internal error: Oops: 5 [#1] PREEMPT SMP
[  664.124615] last sysfs file: /sys/devices/virtual/tty/tty9/uevent
[  664.136766] Modules linked in: ipv6
[  664.143737] CPU: 0    Not tainted  (2.6.36.2-standard #1)
[  664.156244] PC is at throtl_unlink_blkio_group+0x10/0x44
[  664.166852] LR is at blkiocg_destroy+0x90/0x158
[  664.175886] pc : [<802a9c4c>]    lr : [<802a8940>]    psr: 20000013
[  664.175891] sp : 9a00dec8  ip : 9a04a010  fp : 00000001
[  664.198797] r10: 0000009c  r9 : 9a00c000  r8 : 9abdb000
[  664.209215] r7 : 9a24b520  r6 : 9a24b520  r5 : 806d7ab8  r4 : 9abdb000
[  664.222234] r3 : 4ff609b8  r2 : 00000000  r1 : 9a24b520  r0 : 9abdb000
[  664.235254] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[  664.249485] Control: 10c53c7d  Table: 1a12804a  DAC: 00000015
[  664.260942]
[  664.260944] PC: 0x802a9bcc:
[  664.269459] 9bcc  eafffffc ebfffff3 e5950234 eb09b89f e5947000 ea000003 e1a01007 e1a00004
[  664.285861] 9bec  ebfffd77 e1a07006 e2570000 0a000004 e4906018 ebfffc14 e3500000 1afffff8
[  664.302264] 9c0c  eafffff4 e5946214 e5950234 eb09b770 e3560000 0a000000 ebf80ffd e1a00005
[  664.318667] 9c2c  ebffffdc e1a00004 e8bd41f0 eaf8b07b e92d4070 e5903208 e1a04000 e1a06001
[  664.335070] 9c4c  e5930234 eb09b87f e3560000 12461018 01a01006 e1a05000 e1a00004 ebfffd58
[  664.351473] 9c6c  e5943208 e1a01005 e5930234 e8bd4070 ea09b767 e92d4070 e59045ec e1a05000
[  664.367876] 9c8c  e1a06001 e5942210 e594320c e0823003 e3530000 d8bd8070 e2840f8a ebf7432e
[  664.384279] 9cac  e3500000 0a000002 e3a00000 e2841f86 eb001303 e1a00005 e2841f86 e1a02006
[  664.400683]
[  664.400685] LR: 0x802a88c0:
[  664.409200] 88c0  e3c3303f e5932004 e2822001 e5832004 e2846014 e1a00006 eb09bd5d e594301c
[  664.425603] 88e0  e3530000 e1a05000 1a000006 e1a00006 e1a01005 e1a05004 eb09bc48 e5b53020
[  664.442006] 8900  e5936000 ea000023 e2437004 e5138004 e1a00007 ebfffc9c e1a01005 e1a00006
[  664.458411] 8920  eb09bc3e e59f00c4 eb09bd70 e59f30c0 e593508c ea000002 e1a0e00f e595f008
[  664.474816] 8940  e5955000 e5953000 f5d3f000 e59f30a4 e1a00008 e1a01007 e1550003 1afffff5
[  664.491219] 8960  e59f0088 eb09bc41 eaffffd9 e5932000 e5931004 e59fc080 e5812000 e5821004
[  664.507622] 8980  e59f2078 e583c000 e5832004 ebf8b526 e1a03006 e5966000 e1530005 e1a00003
[  664.524025] 89a0  1afffff1 e59f0048 e1a01004 ebf7ddf0 e1a0200d e3c23d7f e3c3303f e5932004
[  664.540429]
[  664.540431] SP: 0x9a00de48:
[  664.548946] de48  9a6ecf70 9a6ec778 9a6ec778 00000000 9a029140 800f04e4 9a00deb8 00000000
[  664.565349] de68  9a029140 ffffffff 9a00deb4 9a24b520 9a24b520 80034b6c 9abdb000 9a24b520
[  664.581752] de88  00000000 4ff609b8 9abdb000 806d7ab8 9a24b520 9a24b520 9abdb000 9a00c000
[  664.598155] dea8  0000009c 00000001 9a04a010 9a00dec8 802a8940 802a9c4c 20000013 ffffffff
[  664.614558] dec8  9a0e57a0 806d7ab8 9a0e57b4 802a8940 9a155480 806d7138 9a6451c8 00000028
[  664.630961] dee8  800351c4 800a1514 9a6001a0 9a6451c8 7ecf5e14 800efaf8 00000000 00000000
[  664.647366] df08  00000b9c 9a6001a0 9a6001a8 800efb64 9a6001d0 9a6001a0 9a6001a8 800f0624
[  664.663769] df28  9a6001a0 00000000 7ecf5e14 800eb460 9a05a9c0 9a029140 9a485090 1375a948
[  664.680173]
[  664.680175] IP: 0x9a049f90:
[  664.688689] 9f90  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  664.705092] 9fb0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  664.721495] 9fd0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  664.737898] 9ff0  00000000 00000000 00000000 00000000 9a02ba00 00000080 00000009 00000080
[  664.754303] a010  806d7198 806d7198 00000002 00000010 9a04a020 9a04a020 9a0e74e8 9abfdbc8
[  664.770706] a030  00000000 9a485090 00000000 00000000 00000000 00000000 00000000 00000000
[  664.787109] a050  00000000 806d71cc 00000000 00000000 00000000 00000000 00000000 00000000
[  664.803512] a070  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  664.819916]
[  664.819918] R0: 0x9abdaf80:
[  664.828433] af80  00616473 00000008 00000000 841e0080 00004909 0c060800 40280220 08008901
[  664.844836] afa0  636f6c62 9abd006b 00000001 00000001 00000010 142d0800 00002400 02d18808
[  664.861239] afc0  65776f70 9abd0072 00000001 00000001 024a8050 72202600 26808013 90100200
[  664.877642] afe0  00616473 00000024 00000000 26852026 06440121 48004000 c190402f 00004800
[  664.894045] b000  9a00b830 00000000 00000000 00000000 fffffa8d 00000000 007dc940 00000000
[  664.910448] b020  00000000 00000000 9abdb029 00000000 00000000 00000000 007dd140 00000000
[  664.926853] b040  000003e8 00000000 00000000 00000003 00000000 00000000 00000000 00000000
[  664.943256] b060  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  664.959660]
[  664.959662] R1: 0x9a24b4a0:
[  664.968177] b4a0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  664.984580] b4c0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  665.000983] b4e0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  665.017386] b500  00000000 00000000 00000000 00000000 00000000 00000002 00000000 00000000
[  665.033791] b520  9abdb000 9a1d7c1c 00000000 742f0000 31747365 00000000 00000000 00000000
[  665.050194] b540  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  665.066597] b560  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  665.083000] b580  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  665.099404]
[  665.099406] R4: 0x9abdaf80:
[  665.107920] af80  00616473 00000008 00000000 841e0080 00004909 0c060800 40280220 08008901
[  665.124323] afa0  636f6c62 9abd006b 00000001 00000001 00000010 142d0800 00002400 02d18808
[  665.140728] afc0  65776f70 9abd0072 00000001 00000001 024a8050 72202600 26808013 90100200
[  665.157131] afe0  00616473 00000024 00000000 26852026 06440121 48004000 c190402f 00004800
[  665.173534] b000  9a00b830 00000000 00000000 00000000 fffffa8d 00000000 007dc940 00000000
[  665.189937] b020  00000000 00000000 9abdb029 00000000 00000000 00000000 007dd140 00000000
[  665.206340] b040  000003e8 00000000 00000000 00000003 00000000 00000000 00000000 00000000
[  665.222743] b060  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  665.239147]
[  665.239149] R5: 0x806d7a38:
[  665.247663] 7a38  74735f74 00737461 00000000 00000000 00000000 00000000 00000000 00000000
[  665.264066] 7a58  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  665.280469] 7a78  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  665.296872] 7a98  00000000 802a7e58 00000000 00000000 00000000 00000000 00000000 00000000
[  665.313275] 7ab8  806d7bb8 806d71c4 802a9c3c 00000000 802a9dd8 802a9d74 802a9d24 802a9cd4
[  665.329678] 7ad8  00000001 806d7b4c 806d6e0c 00000000 00000000 802aa3f8 00000000 00000000
[  665.346081] 7af8  802aa4c8 802aa414 00000000 00000000 802aa434 00000000 802aa450 802aa468
[  665.362484] 7b18  00000000 00000000 00000000 802aa4a0 802aa480 00000000 00000000 706f6f6e
[  665.378890]
[  665.378892] R6: 0x9a24b4a0:
[  665.387406] b4a0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  665.403809] b4c0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  665.420212] b4e0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  665.436615] b500  00000000 00000000 00000000 00000000 00000000 00000002 00000000 00000000
[  665.453018] b520  9abdb000 9a1d7c1c 00000000 742f0000 31747365 00000000 00000000 00000000
[  665.469421] b540  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  665.485824] b560  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  665.502227] b580  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  665.518631]
[  665.518633] R7: 0x9a24b4a0:
[  665.527148] b4a0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  665.543551] b4c0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  665.559954] b4e0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  665.576357] b500  00000000 00000000 00000000 00000000 00000000 00000002 00000000 00000000
[  665.592760] b520  9abdb000 9a1d7c1c 00000000 742f0000 31747365 00000000 00000000 00000000
[  665.609163] b540  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  665.625566] b560  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  665.641969] b580  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  665.658373]
[  665.658375] R8: 0x9abdaf80:
[  665.666889] af80  00616473 00000008 00000000 841e0080 00004909 0c060800 40280220 08008901
[  665.683294] afa0  636f6c62 9abd006b 00000001 00000001 00000010 142d0800 00002400 02d18808
[  665.699697] afc0  65776f70 9abd0072 00000001 00000001 024a8050 72202600 26808013 90100200
[  665.716100] afe0  00616473 00000024 00000000 26852026 06440121 48004000 c190402f 00004800
[  665.732503] b000  9a00b830 00000000 00000000 00000000 fffffa8d 00000000 007dc940 00000000
[  665.748906] b020  00000000 00000000 9abdb029 00000000 00000000 00000000 007dd140 00000000
[  665.765309] b040  000003e8 00000000 00000000 00000003 00000000 00000000 00000000 00000000
[  665.781712] b060  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  665.798116]
[  665.798118] R9: 0x9a00bf80:
[  665.806633] bf80  ff9e63df c7e7feb7 fbae7bbf ffffeeff f7aafff7 7eff9dff 9bf7feff fbacc13f
[  665.823035] bfa0  7bffab2f ddfffffe 0159f972 dfae3ffd fff37fdb ddabef7f af7e3b5f 5bb0fefb
[  665.839440] bfc0  fddb0df7 5fffffef b3ff7d3f bfa7ffff fdf5fffc f94b8f3b fffdbef3 dfb3fb5d
[  665.855845] bfe0  fe7e7f5f 799dee66 e5dfdcf6 3fb77fff f6ff6efd 1d9ff3bf e7ff64fa f7eadd7f
[  665.872248] c000  00000002 00000004 00000000 9a013640 806cdb48 00000000 00000017 9a013640
[  665.888651] c020  80ab4f20 806bf180 00000000 9a0138bc 00000002 9a060200 9a00dd8c 9a00dd20
[  665.905054] c040  80515b14 00000000 00000000 00000000 00000000 00000000 01000000 00000000
[  665.921457] c060  2ab5a6d0 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  665.937863] Process rmdir (pid: 272, stack limit = 0x9a00c2f0)
[  665.949494] Stack: (0x9a00dec8 to 0x9a00e000)
[  665.958180] dec0:                  9a0e57a0 806d7ab8 9a0e57b4 802a8940 9a155480 806d7138
[  665.974495] dee0: 9a6451c8 00000028 800351c4 800a1514 9a6001a0 9a6451c8 7ecf5e14 800efaf8
[  665.990810] df00: 00000000 00000000 00000b9c 9a6001a0 9a6001a8 800efb64 9a6001d0 9a6001a0
[  666.007125] df20: 9a6001a8 800f0624 9a6001a0 00000000 7ecf5e14 800eb460 9a05a9c0 9a029140
[  666.023439] df40: 9a485090 1375a948 00000005 9a263007 00000000 00000014 00000000 00000000
[  666.039756] df60: 00000000 9a060d94 00035000 802b6a2c 00035000 00035000 9a060d94 00014000
[  666.056071] df80: 00035000 9a00c000 00021000 800c9d70 00014000 9a263000 00021000 7ecf5f03
[  666.072386] dfa0: 000133b0 80035040 7ecf5f03 000133b0 7ecf5f03 0000ad44 ffff7994 00000001
[  666.088701] dfc0: 7ecf5f03 000133b0 7ecf5e14 00000028 00013489 00000000 0000009c 00000001
[  666.105015] dfe0: 00000002 7ecf5c78 00008eb0 2acbe5ac 60000010 7ecf5f03 00000000 00000000
[  666.121339] [<802a9c4c>] (throtl_unlink_blkio_group+0x10/0x44) from [<802a8940>] (blkiocg_destroy+)
[  666.141141] [<802a8940>] (blkiocg_destroy+0x90/0x158) from [<800a1514>] (cgroup_diput+0x4c/0xcc)
[  666.158677] [<800a1514>] (cgroup_diput+0x4c/0xcc) from [<800efaf8>] (dentry_iput+0x9c/0xcc)
[  666.175342] [<800efaf8>] (dentry_iput+0x9c/0xcc) from [<800efb64>] (d_kill+0x3c/0x64)
[  666.190966] [<800efb64>] (d_kill+0x3c/0x64) from [<800f0624>] (dput+0x15c/0x178)
[  666.205732] [<800f0624>] (dput+0x15c/0x178) from [<800eb460>] (do_rmdir+0xb0/0xe8)
[  666.220847] [<800eb460>] (do_rmdir+0xb0/0xe8) from [<80035040>] (ret_fast_syscall+0x0/0x30)
[  666.237512] Code: e92d4070 e5903208 e1a04000 e1a06001 (e5930234)
[  666.250238] ---[ end trace 5c44fcc60b1d0750 ]---
[  666.259463] note: rmdir[272] exited with preempt_count 2
[  666.270100] BUG: scheduling while atomic: rmdir/272/0x40000003
[  666.281752] Modules linked in: ipv6
[  666.288758] [<8003a6e8>] (unwind_backtrace+0x0/0xec) from [<805153a4>] (schedule+0x90/0x8f0)
[  666.305614] [<805153a4>] (schedule+0x90/0x8f0) from [<80065974>] (__cond_resched+0x24/0x34)
[  666.322293] [<80065974>] (__cond_resched+0x24/0x34) from [<80515d18>] (_cond_resched+0x30/0x40)
[  666.339675] [<80515d18>] (_cond_resched+0x30/0x40) from [<800c5c08>] (unmap_vmas+0x528/0x5ec)
[  666.356830] [<800c5c08>] (unmap_vmas+0x528/0x5ec) from [<800c8584>] (exit_mmap+0xc4/0x178)
[  666.373340] [<800c8584>] (exit_mmap+0xc4/0x178) from [<8006d930>] (mmput+0x3c/0xf8)
[  666.388694] [<8006d930>] (mmput+0x3c/0xf8) from [<80071a6c>] (exit_mm+0x12c/0x130)
[  666.403816] [<80071a6c>] (exit_mm+0x12c/0x130) from [<800730c0>] (do_exit+0x1d8/0x604)
[  666.419629] [<800730c0>] (do_exit+0x1d8/0x604) from [<80038d5c>] (die+0x294/0x2d4)
[  666.434746] [<80038d5c>] (die+0x294/0x2d4) from [<8003b66c>] (__do_kernel_fault+0x64/0x84)
[  666.451252] [<8003b66c>] (__do_kernel_fault+0x64/0x84) from [<8003b868>] (do_page_fault+0x1dc/0x1f)
[  666.469490] [<8003b868>] (do_page_fault+0x1dc/0x1f0) from [<80034494>] (do_DataAbort+0x34/0x94)
[  666.486971] [<80034494>] (do_DataAbort+0x34/0x94) from [<80034b6c>] (__dabt_svc+0x4c/0x60)
[  666.503467] Exception stack(0x9a00de80 to 0x9a00dec8)
[  666.513598] de80: 9abdb000 9a24b520 00000000 4ff609b8 9abdb000 806d7ab8 9a24b520 9a24b520
[  666.529928] dea0: 9abdb000 9a00c000 0000009c 00000001 9a04a010 9a00dec8 802a8940 802a9c4c
[  666.546252] dec0: 20000013 ffffffff
[  666.553210] [<80034b6c>] (__dabt_svc+0x4c/0x60) from [<802a9c4c>] (throtl_unlink_blkio_group+0x10/)
[  666.571974] [<802a9c4c>] (throtl_unlink_blkio_group+0x10/0x44) from [<802a8940>] (blkiocg_destroy+)
[  666.591780] [<802a8940>] (blkiocg_destroy+0x90/0x158) from [<800a1514>] (cgroup_diput+0x4c/0xcc)
[  666.609430] [<800a1514>] (cgroup_diput+0x4c/0xcc) from [<800efaf8>] (dentry_iput+0x9c/0xcc)
[  666.626173] [<800efaf8>] (dentry_iput+0x9c/0xcc) from [<800efb64>] (d_kill+0x3c/0x64)
[  666.641849] [<800efb64>] (d_kill+0x3c/0x64) from [<800f0624>] (dput+0x15c/0x178)
[  666.656622] [<800f0624>] (dput+0x15c/0x178) from [<800eb460>] (do_rmdir+0xb0/0xe8)
[  666.671821] [<800eb460>] (do_rmdir+0xb0/0xe8) from [<80035040>] (ret_fast_syscall+0x0/0x30)
Segmentation fault

KERNEL: 2.6.36

bsat 07-21-2011 11:38 PM

I am really not sure what exactly is the problem but from this line
Quote:

scheduling while atomic: rmdir/272/0x40000003
Your code seems to scheduling some thing while the kernel is running in atomic mode, just check your code if it is so.

alephan 07-22-2011 03:19 AM

Well i realized by checking kernel change-log from .36 to .37 that this was a well-known problem. I solved this problem by using this patch:

Code:

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 1916bc0..357f472 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1411,13 +1411,14 @@  static void blkiocg_destroy(struct cgroup_subsys *subsys, struct cgroup *cgroup)
                /*
                  * This blkio_group is being unlinked as associated cgroup is
                  * going away. Let all the IO controlling policies know about
-                * this event. Currently this is static call to one io
-                * controlling policy. Once we have more policies in place, we
-                * need some dynamic registration of callback function.
+                * this event.
                  */
                spin_lock(&blkio_list_lock);
-                list_for_each_entry(blkiop, &blkio_list, list)
+                list_for_each_entry(blkiop, &blkio_list, list) {
+                        if (blkiop->plid != blkg->plid)
+                                continue;
                        blkiop->ops.blkio_unlink_group_fn(key, blkg);
+                }
                spin_unlock(&blkio_list_lock);
        } while (1);

@bsat Thanks for the idea. Actually there was a policy problem.

Cheers to all!


All times are GMT -5. The time now is 01:45 PM.