MLK-21457 mmc: block: delete the duplicate calling of mmc_cleanup_queue()
authorHaibo Chen <haibo.chen@nxp.com>
Tue, 16 Apr 2019 02:53:41 +0000 (10:53 +0800)
committerLeonard Crestez <leonard.crestez@nxp.com>
Thu, 18 Apr 2019 00:00:38 +0000 (03:00 +0300)
Fix Mentor back porting issue. According to community log, need to
first backport the commit 57678e5a3d51 ("mmc: block: Delete gendisk
before cleaning up the request queue"), then can back porting the
commit be2ad281466f ("mmc: block: Prevent new req entering queue
after its cleanup"). But Mentor wrongly handle the sequence, and
wrongly handle the conflict, causing the mmc_cleanup_queue() is
called twice. When do sd hot plug test, will meet the following dump:

:~# mmc0: card aaaa removed
------------[ cut here ]------------
WARNING: CPU: 0 PID: 152 at block/blk-core.c:813 blk_cleanup_queue+0x140/0x144
Modules linked in:
CPU: 0 PID: 152 Comm: kworker/0:4 Not tainted 4.19.30-04275-gd0b5d3f8b43d #43
Hardware name: Freescale i.MX7ULP (Device Tree)
Workqueue: events_freezable mmc_rescan
[<8010f998>] (unwind_backtrace) from [<8010bbd8>] (show_stack+0x10/0x14)
[<8010bbd8>] (show_stack) from [<80a473d4>] (dump_stack+0x78/0x8c)
[<80a473d4>] (dump_stack) from [<8012f29c>] (__warn+0xdc/0xf4)
[<8012f29c>] (__warn) from [<8012f3cc>] (warn_slowpath_null+0x40/0x48)
[<8012f3cc>] (warn_slowpath_null) from [<803e3ec8>] (blk_cleanup_queue+0x140/0x144)
[<803e3ec8>] (blk_cleanup_queue) from [<8073f1b0>] (mmc_cleanup_queue+0x28/0x3c)
[<8073f1b0>] (mmc_cleanup_queue) from [<8073cec4>] (mmc_blk_remove_req.part.5+0x2c/0x90)
[<8073cec4>] (mmc_blk_remove_req.part.5) from [<8073d9fc>] (mmc_blk_remove+0xe8/0x1b0)
[<8073d9fc>] (mmc_blk_remove) from [<8072e57c>] (mmc_bus_remove+0x18/0x20)
[<8072e57c>] (mmc_bus_remove) from [<80534930>] (device_release_driver_internal+0x178/0x220)
[<80534930>] (device_release_driver_internal) from [<8053357c>] (bus_remove_device+0xcc/0xf8)
[<8053357c>] (bus_remove_device) from [<80530bc4>] (device_del+0x120/0x358)
[<80530bc4>] (device_del) from [<8072ebf0>] (mmc_remove_card+0x78/0x9c)
[<8072ebf0>] (mmc_remove_card) from [<80734044>] (mmc_sd_detect+0x3c/0x6c)
[<80734044>] (mmc_sd_detect) from [<8072dfa8>] (mmc_rescan+0xcc/0x3f4)
[<8072dfa8>] (mmc_rescan) from [<80146454>] (process_one_work+0x1f0/0x400)
[<80146454>] (process_one_work) from [<801471d8>] (worker_thread+0x44/0x580)
[<801471d8>] (worker_thread) from [<8014c014>] (kthread+0x148/0x150)
[<8014c014>] (kthread) from [<801010e8>] (ret_from_fork+0x14/0x2c)
Exception stack(0xb095bfb0 to 0xb095bff8)
bfa0:                                     00000000 00000000 00000000 00000000
bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
bfe0: 00000000 00000000 00000000 00000000 00000013 00000000
---[ end trace 5bcff5fbec8eea08 ]---
Unable to handle kernel paging request at virtual address 3e700004
pgd = 5bbecc7f
[3e700004] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 0 PID: 152 Comm: kworker/0:4 Tainted: G        W         4.19.30-04275-gd0b5d3f8b43d #43
Hardware name: Freescale i.MX7ULP (Device Tree)
Workqueue: events_freezable mmc_rescan
PC is at __srcu_read_lock+0x1c/0x38
LR is at hctx_lock+0x1c/0x2c
pc : [<8017d91c>]    lr : [<803eedd4>]    psr: 20010093
sp : b095bdf8  ip : 20010013  fp : bf682d80
r10: b083d008  r9 : b083e810  r8 : 00000034
r7 : 00000001  r6 : 00000001  r5 : b09b8400  r4 : b095be00
r3 : 00000004  r2 : 00000001  r1 : b095be00  r0 : 3e700000
Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 10c53c7d  Table: 90c9006a  DAC: 00000051
Process kworker/0:4 (pid: 152, stack limit = 0x37b997f7)
Stack: (0xb095bdf8 to 0xb095c000)
bde0:                                                       81004d08 803ef16c
be00: bf682d80 bd071de2 0000001c 00000000 b0415820 00000001 00000000 803ef278
be20: b08b1c0c b0415820 b083e800 8073f1a8 b08b1c00 b08b1c0c b083e800 8073cedc
be40: b083e800 b08b1c00 b083e808 8073d9fc 60010013 00000034 bf682d80 b083e808
be60: b083e83c 8104db84 00000000 00000034 b083e810 8072e57c b083e808 80534930
be80: b0141a30 b083e808 8104d598 81004d08 810fbf40 8053357c b083e800 b083e808
bea0: b083e860 80530bc4 bf686200 00000000 b083d268 00000000 bf682d80 80172038
bec0: 80db2040 bd071de2 bf686200 b083e800 b083e808 b083d000 bf686200 00000000
bee0: b083d268 00000000 bf682d80 8072ebf0 b083d000 ffffff85 b083d000 80734044
bf00: b083d264 b083d200 b083d000 8072dfa8 b083d264 b096b080 bf682d80 bf686200
bf20: 00000000 80146454 81003d00 bf682d98 b096b080 bf682d80 b096b094 81003d00
bf40: bf682d98 ffffe000 00000008 801471d8 b08e3a70 8109d940 80d256d0 b095a000
bf60: b0968b1c b0968b00 b0968ac0 00000000 b095a000 b096b080 80147194 b0081ea4
bf80: b0968b1c 8014c014 00000000 b0968ac0 8014becc 00000000 00000000 00000000
bfa0: 00000000 00000000 00000000 801010e8 00000000 00000000 00000000 00000000
bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
bfe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[<8017d91c>] (__srcu_read_lock) from [<803eedd4>] (hctx_lock+0x1c/0x2c)
[<803eedd4>] (hctx_lock) from [<803ef16c>] (blk_mq_run_hw_queue+0x28/0xfc)
[<803ef16c>] (blk_mq_run_hw_queue) from [<803ef278>] (blk_mq_run_hw_queues+0x38/0x4c)
[<803ef278>] (blk_mq_run_hw_queues) from [<8073f1a8>] (mmc_cleanup_queue+0x20/0x3c)
[<8073f1a8>] (mmc_cleanup_queue) from [<8073cedc>] (mmc_blk_remove_req.part.5+0x44/0x90)
[<8073cedc>] (mmc_blk_remove_req.part.5) from [<8073d9fc>] (mmc_blk_remove+0xe8/0x1b0)
[<8073d9fc>] (mmc_blk_remove) from [<8072e57c>] (mmc_bus_remove+0x18/0x20)
[<8072e57c>] (mmc_bus_remove) from [<80534930>] (device_release_driver_internal+0x178/0x220)
[<80534930>] (device_release_driver_internal) from [<8053357c>] (bus_remove_device+0xcc/0xf8)
[<8053357c>] (bus_remove_device) from [<80530bc4>] (device_del+0x120/0x358)
[<80530bc4>] (device_del) from [<8072ebf0>] (mmc_remove_card+0x78/0x9c)
[<8072ebf0>] (mmc_remove_card) from [<80734044>] (mmc_sd_detect+0x3c/0x6c)
[<80734044>] (mmc_sd_detect) from [<8072dfa8>] (mmc_rescan+0xcc/0x3f4)
[<8072dfa8>] (mmc_rescan) from [<80146454>] (process_one_work+0x1f0/0x400)
[<80146454>] (process_one_work) from [<801471d8>] (worker_thread+0x44/0x580)
[<801471d8>] (worker_thread) from [<8014c014>] (kthread+0x148/0x150)
[<8014c014>] (kthread) from [<801010e8>] (ret_from_fork+0x14/0x2c)
Exception stack(0xb095bfb0 to 0xb095bff8)
bfa0:                                     00000000 00000000 00000000 00000000
bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
bfe0: 00000000 00000000 00000000 00000000 00000013 00000000
Code: f10c0080 e590307c ee1d0f90 e0833102 (e7931000)
---[ end trace 5bcff5fbec8eea09 ]---
FAT-fs (mmcblk0p1): FAT read failed (blocknr 8)

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
drivers/mmc/core/block.c

index b544519..da94d0a 100644 (file)
@@ -2675,7 +2675,6 @@ static void mmc_blk_remove_req(struct mmc_blk_data *md)
                card = md->queue.card;
                blk_queue_flag_set(QUEUE_FLAG_BYPASS, md->queue.queue);
                blk_set_queue_dying(md->queue.queue);
-               mmc_cleanup_queue(&md->queue);
                if (md->disk->flags & GENHD_FL_UP) {
                        device_remove_file(disk_to_dev(md->disk), &md->force_ro);
                        if ((md->area_type & MMC_BLK_DATA_AREA_BOOT) &&