Bug 98191 - kernel/sched/core.c:7291 __might_sleep+0x87/0x90()
Summary: kernel/sched/core.c:7291 __might_sleep+0x87/0x90()
Status: RESOLVED CODE_FIX
Alias: None
Product: IO/Storage
Classification: Unclassified
Component: MD (show other bugs)
Hardware: x86-64 Linux
: P1 normal
Assignee: io_md
URL:
Keywords:
: 98091 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-05-13 04:27 UTC by poma
Modified: 2015-06-08 11:11 UTC (History)
3 users (show)

See Also:
Kernel Version: 4.0.3-300.fc22.x86_64+debug
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description poma 2015-05-13 04:27:11 UTC
[   20.790847] ------------[ cut here ]------------
[   20.791017] WARNING: CPU: 3 PID: 484 at kernel/sched/core.c:7291 __might_sleep+0x87/0x90()
[   20.791179] do not call blocking ops when !TASK_RUNNING; state=2 set at [<ffffffff81897e55>] wait_for_completion_io+0xe5/0x140
[   20.791824] Modules linked in: arc4 rt2800usb rt2x00usb rt2800lib rt2x00lib mac80211 cfg80211 crc_ccitt rfkill mxl5007t af9013 dvb_usb_af9015 dvb_usb_v2 dvb_core uas rc_core usb_storage tuner_simple tuner_types wm8775 ppdev tda9887 nouveau tda8290 tuner kvm_amd mxm_wmi cx25840 video snd_hda_codec_realtek kvm ttm snd_hda_codec_generic edac_core ivtv edac_mce_amd serio_raw snd_hda_intel tveeprom cx2341x drm_kms_helper v4l2_common snd_hda_controller drm videodev snd_hda_codec ata_generic skge media snd_hda_core i2c_algo_bit pata_acpi snd_hwdep r8169 mii parport_serial snd_seq parport_pc parport snd_seq_device snd_pcm wmi snd_timer snd soundcore shpchp i2c_nforce2 pata_amd acpi_cpufreq ecryptfs nfsd auth_rpcgss encrypted_keys nfs_acl trusted tpm lockd i2c_dev grace binfmt_misc sunrpc raid1
[   20.794756] CPU: 3 PID: 484 Comm: systemd-journal Not tainted 4.1.0-0.rc3.git1.1.fc23.x86_64 #1
...
[   20.796976] Call Trace:
[   20.797419]  [<ffffffff81894445>] dump_stack+0x4c/0x65
[   20.797844]  [<ffffffff810b043a>] warn_slowpath_common+0x8a/0xc0
[   20.798282]  [<ffffffff810b04c5>] warn_slowpath_fmt+0x55/0x70
[   20.798702]  [<ffffffff81897e55>] ? wait_for_completion_io+0xe5/0x140
[   20.799135]  [<ffffffff81897e55>] ? wait_for_completion_io+0xe5/0x140
[   20.799541]  [<ffffffff810e0c17>] __might_sleep+0x87/0x90
[   20.799954]  [<ffffffff813fcc8f>] generic_make_request_checks+0x3f/0x600
[   20.800367]  [<ffffffff8189d406>] ? _raw_spin_unlock_irqrestore+0x36/0x70
[   20.800782]  [<ffffffff8110e0fd>] ? trace_hardirqs_on_caller+0x13d/0x1e0
[   20.801203]  [<ffffffff813fd277>] generic_make_request+0x27/0x130
[   20.801617]  [<ffffffffa0000438>] raid1_unplug+0x108/0x160 [raid1]
[   20.802019]  [<ffffffff8140315a>] blk_flush_plug_list+0x9a/0x260
[   20.802432]  [<ffffffff8189d3b0>] ? _raw_spin_unlock_irq+0x30/0x50
[   20.802840]  [<ffffffff81896800>] io_schedule_timeout+0x120/0x130
[   20.803252]  [<ffffffff8110e1ad>] ? trace_hardirqs_on+0xd/0x10
[   20.803658]  [<ffffffff81897e77>] wait_for_completion_io+0x107/0x140
[   20.804066]  [<ffffffff810e9b40>] ? wake_up_state+0x20/0x20
[   20.804473]  [<ffffffff8140ae67>] __blkdev_issue_zeroout+0x227/0x270
[   20.804870]  [<ffffffff81897dba>] ? wait_for_completion_io+0x4a/0x140
[   20.805273]  [<ffffffff8140af5a>] blkdev_issue_zeroout+0xaa/0x100
[   20.805671]  [<ffffffff813500d2>] ext4_ext_zeroout.isra.34+0x52/0x60
[   20.806071]  [<ffffffff81356080>] ext4_ext_handle_unwritten_extents+0x680/0x10d0
[   20.806478]  [<ffffffff81357027>] ext4_ext_map_blocks+0x527/0x13c0
[   20.806884]  [<ffffffff81323559>] ? ext4_map_blocks+0x179/0x510
[   20.807291]  [<ffffffff81323559>] ? ext4_map_blocks+0x179/0x510
[   20.807684]  [<ffffffff8132357d>] ext4_map_blocks+0x19d/0x510
[   20.808075]  [<ffffffff8132706d>] ext4_writepages+0x7fd/0x13e0
[   20.808466]  [<ffffffff810f2821>] ? update_entity_load_avg+0x381/0x430
[   20.808851]  [<ffffffff81200321>] do_writepages+0x21/0x40
[   20.809237]  [<ffffffff811f1c15>] __filemap_fdatawrite_range+0x65/0x90
[   20.809611]  [<ffffffff811f1d5d>] filemap_write_and_wait_range+0x2d/0x70
[   20.809986]  [<ffffffff8131c083>] ext4_sync_file+0x173/0x660
[   20.810362]  [<ffffffff812bcdab>] vfs_fsync_range+0x4b/0xb0
[   20.810723]  [<ffffffff812bce6d>] do_fsync+0x3d/0x70
[   20.811073]  [<ffffffff812bd160>] SyS_fsync+0x10/0x20
[   20.811413]  [<ffffffff8189de6e>] system_call_fastpath+0x12/0x76
[   20.811744] ---[ end trace 94ce07702a207078 ]---
Comment 1 Jeff Moyer 2015-05-13 12:53:39 UTC
See this commit in Jens' for-4.2/core branch: 

commit 5596d0d591bea25424c07f0fce00df5af593b31f
Author: Shaohua Li <shli@fb.com>
Date:   Fri May 8 10:51:29 2015 -0700

    sched: always use blk_schedule_flush_plug in io_schedule_out

Jens, looks like this one should be pulled into 4.1.
Comment 2 poma 2015-05-13 15:37:43 UTC
I can confirm, given commit has a positive effect,
https://git.kernel.org/cgit/linux/kernel/git/axboe/linux-block.git/commit/?id=5596d0d

Tested with 4.1.0-0.rc3.git1.2.fc21.x86_64 - PASSED

Thanks.
Comment 3 poma 2015-05-13 15:40:17 UTC
*** Bug 98091 has been marked as a duplicate of this bug. ***
Comment 4 poma 2015-05-13 18:22:43 UTC
In fact it is already in linux-next:
https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/kernel/sched/core.c?id=5596d0d
So this will soon catch mainline rc, right.
Comment 5 poma 2015-05-13 23:13:03 UTC
Moreover the same is happening with the stable 4.0.3.

[   11.906422] ------------[ cut here ]------------
[   11.906432] WARNING: CPU: 1 PID: 472 at kernel/sched/core.c:7302 __might_sleep+0x87/0x90()
[   11.906439] do not call blocking ops when !TASK_RUNNING; state=2 set at [<ffffffff818849f5>] wait_for_completion_io+0xe5/0x140
[   11.906465] Modules linked in: ivtv(+) mxm_wmi snd_hda_intel tveeprom video cx2341x ttm serio_raw snd_hda_controller v4l2_common r8169 parport_serial drm_kms_helper parport_pc videodev media i2c_algo_bit drm snd_hda_codec skge mii parport edac_core edac_mce_amd snd_hwdep ata_generic pata_acpi snd_seq snd_seq_device wmi snd_pcm snd_timer snd soundcore shpchp pata_amd i2c_nforce2 acpi_cpufreq nfsd auth_rpcgss nfs_acl ecryptfs lockd grace encrypted_keys trusted sunrpc tpm i2c_dev binfmt_misc raid1
[   11.906469] CPU: 1 PID: 472 Comm: systemd-journal Not tainted 4.0.3-300.fc22.x86_64+debug #1
...
[   11.906476] Call Trace:
[   11.906480]  [<ffffffff81881318>] dump_stack+0x4c/0x65
[   11.906482]  [<ffffffff810ac4ba>] warn_slowpath_common+0x8a/0xc0
[   11.906484]  [<ffffffff810ac545>] warn_slowpath_fmt+0x55/0x70
[   11.906486]  [<ffffffff818849f5>] ? wait_for_completion_io+0xe5/0x140
[   11.906487]  [<ffffffff818849f5>] ? wait_for_completion_io+0xe5/0x140
[   11.906489]  [<ffffffff810dc7b7>] __might_sleep+0x87/0x90
[   11.906492]  [<ffffffff813ef8cf>] generic_make_request_checks+0x3f/0x600
[   11.906495]  [<ffffffff8188a336>] ? _raw_spin_unlock_irqrestore+0x36/0x70
[   11.906497]  [<ffffffff8110be6d>] ? trace_hardirqs_on_caller+0x13d/0x1e0
[   11.906498]  [<ffffffff813efeb7>] generic_make_request+0x27/0x130
[   11.906505]  [<ffffffffa0000438>] raid1_unplug+0x108/0x160 [raid1]
[   11.906507]  [<ffffffff813f5d8a>] blk_flush_plug_list+0x9a/0x260
[   11.906509]  [<ffffffff8188a2e0>] ? _raw_spin_unlock_irq+0x30/0x50
[   11.906511]  [<ffffffff81883340>] io_schedule_timeout+0x120/0x130
[   11.906512]  [<ffffffff8110bf1d>] ? trace_hardirqs_on+0xd/0x10
[   11.906514]  [<ffffffff81884a17>] wait_for_completion_io+0x107/0x140
[   11.906516]  [<ffffffff810e5c90>] ? wake_up_state+0x20/0x20
[   11.906518]  [<ffffffff813fdaa7>] __blkdev_issue_zeroout+0x227/0x270
[   11.906520]  [<ffffffff8188495a>] ? wait_for_completion_io+0x4a/0x140
[   11.906522]  [<ffffffff813fdb9a>] blkdev_issue_zeroout+0xaa/0x100
[   11.906524]  [<ffffffff81346402>] ext4_ext_zeroout.isra.33+0x52/0x60
[   11.906525]  [<ffffffff8134c96b>] ext4_ext_handle_unwritten_extents+0xc3b/0x10d0
[   11.906527]  [<ffffffff8134d357>] ext4_ext_map_blocks+0x527/0x13e0
[   11.906530]  [<ffffffff81319a59>] ? ext4_map_blocks+0x179/0x510
[   11.906531]  [<ffffffff81319a59>] ? ext4_map_blocks+0x179/0x510
[   11.906532]  [<ffffffff81319a7d>] ext4_map_blocks+0x19d/0x510
[   11.906534]  [<ffffffff8131d292>] ? ext4_writepages+0x522/0x13e0
[   11.906535]  [<ffffffff8131d56d>] ext4_writepages+0x7fd/0x13e0
[   11.906539]  [<ffffffff811f77f1>] do_writepages+0x21/0x40
[   11.906541]  [<ffffffff811e9175>] __filemap_fdatawrite_range+0x65/0x90
[   11.906542]  [<ffffffff811e92bd>] filemap_write_and_wait_range+0x2d/0x70
[   11.906544]  [<ffffffff813125f3>] ext4_sync_file+0x173/0x660
[   11.906546]  [<ffffffff812b365e>] vfs_fsync_range+0x4e/0xb0
[   11.906548]  [<ffffffff812b371d>] do_fsync+0x3d/0x70
[   11.906549]  [<ffffffff812b3a10>] SyS_fsync+0x10/0x20
[   11.906551]  [<ffffffff8188ae89>] system_call_fastpath+0x12/0x17
[   11.906552] ---[ end trace b410c9ba3fb479ca ]---
Comment 6 poma 2015-05-14 03:31:23 UTC
I patched the stable 4.0.3-300.fc22.x86_64+debug with the 5596d0d,
and the result is no muss, no fuss:

4.0.3-201.fc21.x86_64+debug - PASSED

Stable 3.19.8 is EOL,
so guys, care to push 5596d0d to the stable 4.0.3?
Comment 7 Neil Brown 2015-05-14 04:22:54 UTC
> care to push 5596d0d to the stable 4.0.3?

The best thing to do is to wait for the patch to appear in mainline, and the email stable@vger.kernel.org asking for it to be included in some stable release.
Comment 8 poma 2015-05-14 15:19:36 UTC
No problemos, I really hope this bug is not a critical one.
Comment 10 Jens Axboe 2015-05-18 22:07:16 UTC
I've pulled it into fixes for this series, it'll be in -rc5.
Comment 12 poma 2015-06-08 11:11:01 UTC
This is already a part of stable 4.0.x.

Thanks guys.

Note You need to log in before you can comment on or make changes to this bug.