From: akpm@linux-foundation.org Subject: + block-fix-possible-sleep-in-invalid-context.patch added to -mm tree Date: Mon, 01 Jul 2013 15:15:09 -0700 Message-ID: <51d1ff6d.nNzT2jNOlI84nHAD%akpm@linux-foundation.org> Reply-To: linux-kernel@vger.kernel.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from mail.linuxfoundation.org ([140.211.169.12]:49972 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755658Ab3GAWPK (ORCPT ); Mon, 1 Jul 2013 18:15:10 -0400 Sender: mm-commits-owner@vger.kernel.org List-Id: mm-commits@vger.kernel.org To: mm-commits@vger.kernel.org, stable@vger.kernel.org, rjw@sisk.pl, axboe@kernel.dk, sthumma@codeaurora.org Subject: + block-fix-possible-sleep-in-invalid-context.patch added to -mm tree To: sthumma@codeaurora.org,axboe@kernel.dk,rjw@sisk.pl,stable@vger.kernel.org From: akpm@linux-foundation.org Date: Mon, 01 Jul 2013 15:15:09 -0700 The patch titled Subject: block: Fix possible sleep in invalid context has been added to the -mm tree. Its filename is block-fix-possible-sleep-in-invalid-context.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/block-fix-possible-sleep-in-invalid-context.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/block-fix-possible-sleep-in-invalid-context.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Sujit Reddy Thumma Subject: block: Fix possible sleep in invalid context When block runtime PM is enabled following warning is seen while resuming the device. BUG: sleeping function called from invalid context at .../drivers/base/power/runtime.c:923 in_atomic(): 1, irqs_disabled(): 128, pid: 12, name: kworker/0:1 [] (unwind_backtrace+0x0/0x120) from [] (__pm_runtime_suspend+0x34/0xa0) from [] (blk_post_runtime_resume+0x4c/0x5c) from [] (scsi_runtime_resume+0x90/0xb4) from [] (__rpm_callback+0x30/0x58) from [] (rpm_callback+0x18/0x28) from [] (rpm_resume+0x3dc/0x540) from [] (pm_runtime_work+0x8c/0x98) from [] (process_one_work+0x238/0x3e4) from [] (worker_thread+0x1ac/0x2ac) from [] (kthread+0x88/0x94) from [] (kernel_thread_exit+0x0/0x8) Fix this by releasing spin_lock_irq() before calling pm_runtime_autosuspend() in blk_post_runtime_resume(). Signed-off-by: Sujit Reddy Thumma Cc: Jens Axboe Cc: "Rafael J. Wysocki" Cc: Signed-off-by: Andrew Morton --- block/blk-core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff -puN block/blk-core.c~block-fix-possible-sleep-in-invalid-context block/blk-core.c --- a/block/blk-core.c~block-fix-possible-sleep-in-invalid-context +++ a/block/blk-core.c @@ -3159,16 +3159,18 @@ EXPORT_SYMBOL(blk_pre_runtime_resume); */ void blk_post_runtime_resume(struct request_queue *q, int err) { - spin_lock_irq(q->queue_lock); if (!err) { + spin_lock_irq(q->queue_lock); q->rpm_status = RPM_ACTIVE; __blk_run_queue(q); pm_runtime_mark_last_busy(q->dev); + spin_unlock_irq(q->queue_lock); pm_request_autosuspend(q->dev); } else { + spin_lock_irq(q->queue_lock); q->rpm_status = RPM_SUSPENDED; + spin_unlock_irq(q->queue_lock); } - spin_unlock_irq(q->queue_lock); } EXPORT_SYMBOL(blk_post_runtime_resume); #endif _ Patches currently in -mm which might be from sthumma@codeaurora.org are linux-next.patch block-fix-possible-sleep-in-invalid-context.patch