Bug 8764 - BUG: sleeping function called from invalid context at mm/slub.c:937
Summary: BUG: sleeping function called from invalid context at mm/slub.c:937
Status: RESOLVED FIXED
Alias: None
Product: CifsVFS
Classification: Unclassified
Component: kernel fs (show other bugs)
Version: 2.6
Hardware: All All
: P5 critical
Target Milestone: ---
Assignee: Pavel Shilovsky
QA Contact: Jeff Layton
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-17 15:48 UTC by Jeff Layton
Modified: 2012-03-03 07:51 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Layton 2012-02-17 15:48:20 UTC
Recent versions of cifs.ko have a significant bug:

[342137.052722] BUG: sleeping function called from invalid context at mm/slub.c:937
[342137.055649] in_atomic(): 1, irqs_disabled(): 0, pid: 33, name: kworker/2:1
[342137.057846] 4 locks held by kworker/2:1/33:
[342137.059188]  #0:  (cifsiod){.+.+.+}, at: [<ffffffff810834cc>] process_one_work+0x17c/0x680
[342137.059922]  #1:  ((&pCifsFile->oplock_break)){+.+.+.}, at: [<ffffffff810834cc>] process_one_work+0x17c/0x680
[342137.060881]  #2:  (&cifsi->lock_mutex){+.+.+.}, at: [<ffffffffa0167b10>] cifs_push_posix_locks+0x80/0x2f0 [cifs]
[342137.061727]  #3:  (file_lock_lock){+.+.+.}, at: [<ffffffff8120be35>] lock_flocks+0x15/0x20
[342137.062451] Pid: 33, comm: kworker/2:1 Tainted: G           O 3.3.0-0.rc3.git2.2.fc18.x86_64 #1
[342137.063216] Call Trace:
[342137.063418]  [<ffffffff81095dec>] __might_sleep+0x13c/0x200
[342137.063850]  [<ffffffff811a22cb>] kmem_cache_alloc_trace+0x4b/0x240
[342137.064363]  [<ffffffffa016792c>] cifs_lock_init+0x4c/0xd0 [cifs]
[342137.064830]  [<ffffffff8120be35>] ? lock_flocks+0x15/0x20
[342137.065268]  [<ffffffffa0167c00>] cifs_push_posix_locks+0x170/0x2f0 [cifs]
[342137.065786]  [<ffffffffa0152747>] ? cifs_writedata_release+0x27/0x30 [cifs]
[342137.066349]  [<ffffffff81150d90>] ? find_get_pages+0x40/0x2c0
[342137.066786]  [<ffffffff8115c292>] ? pagevec_lookup+0x22/0x30
[342137.067254]  [<ffffffff8115e65c>] ? invalidate_mapping_pages+0x7c/0x1a0
[342137.067751]  [<ffffffff8115b4b2>] ? do_writepages+0x22/0x50
[342137.068204]  [<ffffffff8114f80b>] ? __filemap_fdatawrite_range+0x5b/0x60
[342137.068709]  [<ffffffffa0168176>] cifs_oplock_break+0x346/0x540 [cifs]
[342137.069235]  [<ffffffff810834cc>] ? process_one_work+0x17c/0x680
[342137.069690]  [<ffffffff81083534>] process_one_work+0x1e4/0x680
[342137.070160]  [<ffffffff810834cc>] ? process_one_work+0x17c/0x680
[342137.070616]  [<ffffffffa0167e30>] ? cifs_page_mkwrite+0x50/0x50 [cifs]
[342137.071304]  [<ffffffff81083d46>] worker_thread+0x126/0x2d0
[342137.071791]  [<ffffffff81083c20>] ? rescuer_thread+0x210/0x210
[342137.072299]  [<ffffffff81089ac7>] kthread+0xb7/0xc0
[342137.072699]  [<ffffffff810cd02d>] ? trace_hardirqs_on+0xd/0x10
[342137.073198]  [<ffffffff816a7774>] kernel_thread_helper+0x4/0x10
[342137.073672]  [<ffffffff8169db34>] ? retint_restore_args+0x13/0x13
[342137.074187]  [<ffffffff81089a10>] ? kthread_worker_fn+0x1a0/0x1a0
[342137.074676]  [<ffffffff816a7770>] ? gs_change+0x13/0x13

...the problem is that cifs_push_posix_locks() calls lock_flock which locks
a spinlock and then calls cifs_lock_init which kmallocs a new structure. This
needs to be fixed ASAP and the fix pushed to stable.
Comment 1 Pavel Shilovsky 2012-02-22 09:14:28 UTC
Posted the patch to the list (linux-cifs): [PATCH] CIFS: Do not kmalloc under the flocks spinlock.
Comment 2 Pavel Shilovsky 2012-03-03 07:51:20 UTC
Posted the second version of the patch.