mmc: card: use blk_cleanup_queue() during shutdown/reboot
It is preferred to use blk_cleanup_queue() instead of blk_stop_queue() during reboot/shutdown due to these reasons - 1. blk_cleanup_queue() marks the queue as dying/dead which prevents the new requests from getting inserted into the queue after MMC driver shutdown. If we just use blk_stop_queue(), the requests are still allowed into the request_queue but are not dispatched to the low level MMC driver as the queue is marked as stopped. This may result into deadlock/hang issue during shutdown, if FS (as part of emergency remount) is waiting for the queued request to be completed without relinquishing the CPU. If some CPU bound workqueues related to shutdown are pending on that CPU, then shutdown may hang. 2. blk_cleanup_queue() also drains the queue completely by processing all the pending requests from the elevator queue even though those are not yet dispatched to request_queue and also waits for the completion of all those requests. Also, do not override the queue_lock in request_queue structure with md->lock as this will cause below problem when using blk_cleanup_queue() in shutdown. This happens because blk_cleanup_queue() changes queue_lock from driver md->lock to it's original request_queue lock. Callstack: <6> BUG: spinlock already unlocked on CPU#6, iozone/4391 <6> lock: 0xffffffc06ab8be80, .magic: dead4ead, .owner: <none>/-1, .owner_cpu: -1 [ffffffc0420e3b28] __delay at ffffffc00031a328 [ffffffc0420e3b38] __const_udelay at ffffffc00031a304 [ffffffc0420e3b58] msm_trigger_wdog_bite at ffffffc0004476cc [ffffffc0420e3b68] spin_bug at ffffffc0000e4554 [ffffffc0420e3b98] do_raw_spin_unlock at ffffffc0000e47a0 [ffffffc0420e3bc8] _raw_spin_unlock_irq at ffffffc000db3ee0 [ffffffc0420e3be8] blk_queue_bio at ffffffc0002ff1e4 [ffffffc0420e3bf8] generic_make_request at ffffffc0002fd210 [ffffffc0420e3c58] submit_bio at ffffffc0002fd328 [ffffffc0420e3ca8] submit_bio_wait at ffffffc0002f5768 [ffffffc0420e3d00] compat_sys_call_table at ffffffc00008e000 [ffffffc0420e3d18] submit_bio_wait at ffffffc0002f574c [ffffffc0420e3d38] __blkdev_issue_flush at ffffffc00030043c [ffffffc0420e3da8] blkdev_issue_flush at ffffffc000300494 [ffffffc0420e3dd8] ext4_sync_fs at ffffffc0002597a4 Change-Id: Iaa26944ccc6c279390215869f5003156400840ed Signed-off-by:Sahitya Tummala <stummala@codeaurora.org> [xiaonian@codeaurora.org: fixed trivial merge conflicts] Signed-off-by:
Xiaonian Wang <xiaonian@codeaurora.org>
Loading
Please register or sign in to comment