All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: block: Delete gendisk before cleaning up the request queue
@ 2018-03-22  7:49 Shawn Lin
       [not found] ` <1521704940-45406-1-git-send-email-shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Shawn Lin @ 2018-03-22  7:49 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Jaehoon Chung, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Shawn Lin, linux-mmc-u79uwXL29TY76Z2rM5mHXA, Adrian Hunter

dd if=/dev/urandom of=/dev/mmcblk1 bs=4k count=10000
with a SD card hotplug during transfer reports a warning below:

Remove the disk, partition and bdi sysfs attributes before cleaning
up the request queue associated with the disk.

[  410.331226] mmc1: card 59b4 removed
[  410.348583] WARNING: CPU: 0 PID: 5 at block/blk-core.c:785
blk_cleanup_queue+0x138/0x140
[  410.349294] Modules linked in:
[  410.349570] CPU: 0 PID: 5 Comm: kworker/0:0 Not tainted
4.16.0-rc6-next-20180321-00004-gc2ad6a7 #263
[  410.350363] Hardware name: Excavator-RK3399 Board (DT)
[  410.350819] Workqueue: events_freezable mmc_rescan
[  410.351242] pstate: 60000005 (nZCv daif -PAN -UAO)
[  410.351663] pc : blk_cleanup_queue+0x138/0x140
[  410.352054] lr : blk_cleanup_queue+0xac/0x140
[  410.352436] sp : ffff0000092cbb90
[  410.352727] x29: ffff0000092cbb90 x28: 0000000000000000
[  410.353195] x27: ffff8000f6f23030 x26: ffff00000904e610
[  410.353662] x25: ffff8000f17cc808 x24: ffff8000f1038200
[  410.354128] x23: 0000000000000060 x22: 0000000000000000
[  410.354595] x21: ffff8000f11748d8 x20: ffff8000f1038200
[  410.355061] x19: ffff8000f1174200 x18: 0000ffff936347d8
[  410.355528] x17: 0000ffff935b93c0 x16: ffff0000081263f8
[  410.355994] x15: 0000000000000000 x14: 0000000000000400
[  410.356461] x13: 0000000000000001 x12: 0000000000000001
[  410.356927] x11: 0000000000000040 x10: ffff8000f2400028
[  410.357393] x9 : ffff8000f2400040 x8 : 0000000000000000
[  410.357860] x7 : ffff8000f6f3a340 x6 : ffff8000f6f3a340
[  410.358326] x5 : ffff8000f2400000 x4 : ffff8000f6f3a340
[  410.358792] x3 : 0000000000000000 x2 : 39c1333e45670800
[  410.359259] x1 : 0000000000000000 x0 : 0000000000000003
[  410.359726] Call trace:
[  410.359943]  blk_cleanup_queue+0x138/0x140
[  410.360305]  mmc_cleanup_queue+0x2c/0x48
[  410.360652]  mmc_blk_remove_req+0x1c/0x98
[  410.361005]  mmc_blk_remove+0x180/0x1c0
[  410.361343]  mmc_bus_remove+0x1c/0x28
[  410.361670]  device_release_driver_internal+0x154/0x1f0
[  410.362128]  device_release_driver+0x14/0x20
[  410.362504]  bus_remove_device+0xc8/0x108
[  410.362858]  device_del+0x120/0x350
[  410.363167]  mmc_remove_card+0x5c/0xb8
[  410.363498]  mmc_sd_detect+0x40/0x78
[  410.363813]  mmc_rescan+0x19c/0x368
[  410.364123]  process_one_work+0x1ac/0x318
[  410.364477]  worker_thread+0x50/0x450
[  410.364801]  kthread+0xf8/0x128
[  410.365081]  ret_from_fork+0x10/0x18
[  410.365395] ---[ end trace 268e87a46c28968c ]---

Signed-off-by: Shawn Lin <shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
---

 drivers/mmc/core/block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index a2b9c25..02485e3 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -2659,7 +2659,6 @@ static void mmc_blk_remove_req(struct mmc_blk_data *md)
 		 * from being accepted.
 		 */
 		card = md->queue.card;
-		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) &&
@@ -2669,6 +2668,7 @@ static void mmc_blk_remove_req(struct mmc_blk_data *md)
 
 			del_gendisk(md->disk);
 		}
+		mmc_cleanup_queue(&md->queue);
 		mmc_blk_put(md);
 	}
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] mmc: block: Delete gendisk before cleaning up the request queue
       [not found] ` <1521704940-45406-1-git-send-email-shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
@ 2018-03-22  8:26   ` Adrian Hunter
       [not found]     ` <f1c54ab8-aa38-69bc-b55a-fd8decc67d2d-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Adrian Hunter @ 2018-03-22  8:26 UTC (permalink / raw)
  To: Shawn Lin, Ulf Hansson
  Cc: Jaehoon Chung, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA

On 22/03/18 09:49, Shawn Lin wrote:
> dd if=/dev/urandom of=/dev/mmcblk1 bs=4k count=10000
> with a SD card hotplug during transfer reports a warning below:

What kernel version / commit was it?

> 
> Remove the disk, partition and bdi sysfs attributes before cleaning
> up the request queue associated with the disk.
> 
> [  410.331226] mmc1: card 59b4 removed
> [  410.348583] WARNING: CPU: 0 PID: 5 at block/blk-core.c:785
> blk_cleanup_queue+0x138/0x140
> [  410.349294] Modules linked in:
> [  410.349570] CPU: 0 PID: 5 Comm: kworker/0:0 Not tainted
> 4.16.0-rc6-next-20180321-00004-gc2ad6a7 #263
> [  410.350363] Hardware name: Excavator-RK3399 Board (DT)
> [  410.350819] Workqueue: events_freezable mmc_rescan
> [  410.351242] pstate: 60000005 (nZCv daif -PAN -UAO)
> [  410.351663] pc : blk_cleanup_queue+0x138/0x140
> [  410.352054] lr : blk_cleanup_queue+0xac/0x140
> [  410.352436] sp : ffff0000092cbb90
> [  410.352727] x29: ffff0000092cbb90 x28: 0000000000000000
> [  410.353195] x27: ffff8000f6f23030 x26: ffff00000904e610
> [  410.353662] x25: ffff8000f17cc808 x24: ffff8000f1038200
> [  410.354128] x23: 0000000000000060 x22: 0000000000000000
> [  410.354595] x21: ffff8000f11748d8 x20: ffff8000f1038200
> [  410.355061] x19: ffff8000f1174200 x18: 0000ffff936347d8
> [  410.355528] x17: 0000ffff935b93c0 x16: ffff0000081263f8
> [  410.355994] x15: 0000000000000000 x14: 0000000000000400
> [  410.356461] x13: 0000000000000001 x12: 0000000000000001
> [  410.356927] x11: 0000000000000040 x10: ffff8000f2400028
> [  410.357393] x9 : ffff8000f2400040 x8 : 0000000000000000
> [  410.357860] x7 : ffff8000f6f3a340 x6 : ffff8000f6f3a340
> [  410.358326] x5 : ffff8000f2400000 x4 : ffff8000f6f3a340
> [  410.358792] x3 : 0000000000000000 x2 : 39c1333e45670800
> [  410.359259] x1 : 0000000000000000 x0 : 0000000000000003
> [  410.359726] Call trace:
> [  410.359943]  blk_cleanup_queue+0x138/0x140
> [  410.360305]  mmc_cleanup_queue+0x2c/0x48
> [  410.360652]  mmc_blk_remove_req+0x1c/0x98
> [  410.361005]  mmc_blk_remove+0x180/0x1c0
> [  410.361343]  mmc_bus_remove+0x1c/0x28
> [  410.361670]  device_release_driver_internal+0x154/0x1f0
> [  410.362128]  device_release_driver+0x14/0x20
> [  410.362504]  bus_remove_device+0xc8/0x108
> [  410.362858]  device_del+0x120/0x350
> [  410.363167]  mmc_remove_card+0x5c/0xb8
> [  410.363498]  mmc_sd_detect+0x40/0x78
> [  410.363813]  mmc_rescan+0x19c/0x368
> [  410.364123]  process_one_work+0x1ac/0x318
> [  410.364477]  worker_thread+0x50/0x450
> [  410.364801]  kthread+0xf8/0x128
> [  410.365081]  ret_from_fork+0x10/0x18
> [  410.365395] ---[ end trace 268e87a46c28968c ]---
> 
> Signed-off-by: Shawn Lin <shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
> ---
> 
>  drivers/mmc/core/block.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
> index a2b9c25..02485e3 100644
> --- a/drivers/mmc/core/block.c
> +++ b/drivers/mmc/core/block.c
> @@ -2659,7 +2659,6 @@ static void mmc_blk_remove_req(struct mmc_blk_data *md)
>  		 * from being accepted.
>  		 */
>  		card = md->queue.card;
> -		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) &&
> @@ -2669,6 +2668,7 @@ static void mmc_blk_remove_req(struct mmc_blk_data *md)
>  
>  			del_gendisk(md->disk);
>  		}
> +		mmc_cleanup_queue(&md->queue);
>  		mmc_blk_put(md);
>  	}
>  }
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] mmc: block: Delete gendisk before cleaning up the request queue
       [not found]     ` <f1c54ab8-aa38-69bc-b55a-fd8decc67d2d-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2018-03-22  8:43       ` Shawn Lin
       [not found]         ` <ba973085-9321-c782-2eb1-68a1ff67366c-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Shawn Lin @ 2018-03-22  8:43 UTC (permalink / raw)
  To: Adrian Hunter, Ulf Hansson
  Cc: Jaehoon Chung, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	shawn.lin-TNX95d0MmH7DzftRWevZcw,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA

On 2018/3/22 16:26, Adrian Hunter wrote:
> On 22/03/18 09:49, Shawn Lin wrote:
>> dd if=/dev/urandom of=/dev/mmcblk1 bs=4k count=10000
>> with a SD card hotplug during transfer reports a warning below:
> 
> What kernel version / commit was it?

Actually the log below has it, it is clean : 4.16.0-rc6-next-20180321

> 
>>
>> Remove the disk, partition and bdi sysfs attributes before cleaning
>> up the request queue associated with the disk.
>>
>> [  410.331226] mmc1: card 59b4 removed
>> [  410.348583] WARNING: CPU: 0 PID: 5 at block/blk-core.c:785
>> blk_cleanup_queue+0x138/0x140
>> [  410.349294] Modules linked in:
>> [  410.349570] CPU: 0 PID: 5 Comm: kworker/0:0 Not tainted
>> 4.16.0-rc6-next-20180321-00004-gc2ad6a7 #263
>> [  410.350363] Hardware name: Excavator-RK3399 Board (DT)
>> [  410.350819] Workqueue: events_freezable mmc_rescan
>> [  410.351242] pstate: 60000005 (nZCv daif -PAN -UAO)
>> [  410.351663] pc : blk_cleanup_queue+0x138/0x140
>> [  410.352054] lr : blk_cleanup_queue+0xac/0x140
>> [  410.352436] sp : ffff0000092cbb90
>> [  410.352727] x29: ffff0000092cbb90 x28: 0000000000000000
>> [  410.353195] x27: ffff8000f6f23030 x26: ffff00000904e610
>> [  410.353662] x25: ffff8000f17cc808 x24: ffff8000f1038200
>> [  410.354128] x23: 0000000000000060 x22: 0000000000000000
>> [  410.354595] x21: ffff8000f11748d8 x20: ffff8000f1038200
>> [  410.355061] x19: ffff8000f1174200 x18: 0000ffff936347d8
>> [  410.355528] x17: 0000ffff935b93c0 x16: ffff0000081263f8
>> [  410.355994] x15: 0000000000000000 x14: 0000000000000400
>> [  410.356461] x13: 0000000000000001 x12: 0000000000000001
>> [  410.356927] x11: 0000000000000040 x10: ffff8000f2400028
>> [  410.357393] x9 : ffff8000f2400040 x8 : 0000000000000000
>> [  410.357860] x7 : ffff8000f6f3a340 x6 : ffff8000f6f3a340
>> [  410.358326] x5 : ffff8000f2400000 x4 : ffff8000f6f3a340
>> [  410.358792] x3 : 0000000000000000 x2 : 39c1333e45670800
>> [  410.359259] x1 : 0000000000000000 x0 : 0000000000000003
>> [  410.359726] Call trace:
>> [  410.359943]  blk_cleanup_queue+0x138/0x140
>> [  410.360305]  mmc_cleanup_queue+0x2c/0x48
>> [  410.360652]  mmc_blk_remove_req+0x1c/0x98
>> [  410.361005]  mmc_blk_remove+0x180/0x1c0
>> [  410.361343]  mmc_bus_remove+0x1c/0x28
>> [  410.361670]  device_release_driver_internal+0x154/0x1f0
>> [  410.362128]  device_release_driver+0x14/0x20
>> [  410.362504]  bus_remove_device+0xc8/0x108
>> [  410.362858]  device_del+0x120/0x350
>> [  410.363167]  mmc_remove_card+0x5c/0xb8
>> [  410.363498]  mmc_sd_detect+0x40/0x78
>> [  410.363813]  mmc_rescan+0x19c/0x368
>> [  410.364123]  process_one_work+0x1ac/0x318
>> [  410.364477]  worker_thread+0x50/0x450
>> [  410.364801]  kthread+0xf8/0x128
>> [  410.365081]  ret_from_fork+0x10/0x18
>> [  410.365395] ---[ end trace 268e87a46c28968c ]---
>>
>> Signed-off-by: Shawn Lin <shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
>> ---
>>
>>   drivers/mmc/core/block.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
>> index a2b9c25..02485e3 100644
>> --- a/drivers/mmc/core/block.c
>> +++ b/drivers/mmc/core/block.c
>> @@ -2659,7 +2659,6 @@ static void mmc_blk_remove_req(struct mmc_blk_data *md)
>>   		 * from being accepted.
>>   		 */
>>   		card = md->queue.card;
>> -		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) &&
>> @@ -2669,6 +2668,7 @@ static void mmc_blk_remove_req(struct mmc_blk_data *md)
>>   
>>   			del_gendisk(md->disk);
>>   		}
>> +		mmc_cleanup_queue(&md->queue);
>>   		mmc_blk_put(md);
>>   	}
>>   }
>>
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] mmc: block: Delete gendisk before cleaning up the request queue
       [not found]         ` <ba973085-9321-c782-2eb1-68a1ff67366c-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
@ 2018-03-22  9:31           ` Adrian Hunter
       [not found]             ` <1e104a4a-0508-97ee-4235-12de3e38b417-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Adrian Hunter @ 2018-03-22  9:31 UTC (permalink / raw)
  To: Shawn Lin, Ulf Hansson
  Cc: Jaehoon Chung, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA

On 22/03/18 10:43, Shawn Lin wrote:
> On 2018/3/22 16:26, Adrian Hunter wrote:
>> On 22/03/18 09:49, Shawn Lin wrote:
>>> dd if=/dev/urandom of=/dev/mmcblk1 bs=4k count=10000
>>> with a SD card hotplug during transfer reports a warning below:
>>
>> What kernel version / commit was it?
> 
> Actually the log below has it, it is clean : 4.16.0-rc6-next-20180321

Ok so it seems to be coming from this patch in next:

commit a063057d7c731cffa7d10740e8ebc2970df8dbb3
Author: Bart Van Assche <bart.vanassche@wdc.com>
Date:   Wed Feb 28 10:15:33 2018 -0800

    block: Fix a race between request queue removal and the block cgroup controller

    Avoid that the following race can occur:

    blk_cleanup_queue()               blkcg_print_blkgs()
      spin_lock_irq(lock) (1)           spin_lock_irq(blkg->q->queue_lock) (2,5)
        q->queue_lock = &q->__queue_lock (3)
      spin_unlock_irq(lock) (4)
                                        spin_unlock_irq(blkg->q->queue_lock) (6)

    (1) take driver lock;
    (2) busy loop for driver lock;
    (3) override driver lock with internal lock;
    (4) unlock driver lock;
    (5) can take driver lock now;
    (6) but unlock internal lock.

    This change is safe because only the SCSI core and the NVME core keep
    a reference on a request queue after having called blk_cleanup_queue().
    Neither driver accesses any of the removed data structures between its
    blk_cleanup_queue() and blk_put_queue() calls.

    Reported-by: Joseph Qi <joseph.qi@linux.alibaba.com>
    Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
    Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
    Cc: Jan Kara <jack@suse.com>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>


> 
>>
>>>
>>> Remove the disk, partition and bdi sysfs attributes before cleaning
>>> up the request queue associated with the disk.
>>>
>>> [  410.331226] mmc1: card 59b4 removed
>>> [  410.348583] WARNING: CPU: 0 PID: 5 at block/blk-core.c:785
>>> blk_cleanup_queue+0x138/0x140
>>> [  410.349294] Modules linked in:
>>> [  410.349570] CPU: 0 PID: 5 Comm: kworker/0:0 Not tainted
>>> 4.16.0-rc6-next-20180321-00004-gc2ad6a7 #263
>>> [  410.350363] Hardware name: Excavator-RK3399 Board (DT)
>>> [  410.350819] Workqueue: events_freezable mmc_rescan
>>> [  410.351242] pstate: 60000005 (nZCv daif -PAN -UAO)
>>> [  410.351663] pc : blk_cleanup_queue+0x138/0x140
>>> [  410.352054] lr : blk_cleanup_queue+0xac/0x140
>>> [  410.352436] sp : ffff0000092cbb90
>>> [  410.352727] x29: ffff0000092cbb90 x28: 0000000000000000
>>> [  410.353195] x27: ffff8000f6f23030 x26: ffff00000904e610
>>> [  410.353662] x25: ffff8000f17cc808 x24: ffff8000f1038200
>>> [  410.354128] x23: 0000000000000060 x22: 0000000000000000
>>> [  410.354595] x21: ffff8000f11748d8 x20: ffff8000f1038200
>>> [  410.355061] x19: ffff8000f1174200 x18: 0000ffff936347d8
>>> [  410.355528] x17: 0000ffff935b93c0 x16: ffff0000081263f8
>>> [  410.355994] x15: 0000000000000000 x14: 0000000000000400
>>> [  410.356461] x13: 0000000000000001 x12: 0000000000000001
>>> [  410.356927] x11: 0000000000000040 x10: ffff8000f2400028
>>> [  410.357393] x9 : ffff8000f2400040 x8 : 0000000000000000
>>> [  410.357860] x7 : ffff8000f6f3a340 x6 : ffff8000f6f3a340
>>> [  410.358326] x5 : ffff8000f2400000 x4 : ffff8000f6f3a340
>>> [  410.358792] x3 : 0000000000000000 x2 : 39c1333e45670800
>>> [  410.359259] x1 : 0000000000000000 x0 : 0000000000000003
>>> [  410.359726] Call trace:
>>> [  410.359943]  blk_cleanup_queue+0x138/0x140
>>> [  410.360305]  mmc_cleanup_queue+0x2c/0x48
>>> [  410.360652]  mmc_blk_remove_req+0x1c/0x98
>>> [  410.361005]  mmc_blk_remove+0x180/0x1c0
>>> [  410.361343]  mmc_bus_remove+0x1c/0x28
>>> [  410.361670]  device_release_driver_internal+0x154/0x1f0
>>> [  410.362128]  device_release_driver+0x14/0x20
>>> [  410.362504]  bus_remove_device+0xc8/0x108
>>> [  410.362858]  device_del+0x120/0x350
>>> [  410.363167]  mmc_remove_card+0x5c/0xb8
>>> [  410.363498]  mmc_sd_detect+0x40/0x78
>>> [  410.363813]  mmc_rescan+0x19c/0x368
>>> [  410.364123]  process_one_work+0x1ac/0x318
>>> [  410.364477]  worker_thread+0x50/0x450
>>> [  410.364801]  kthread+0xf8/0x128
>>> [  410.365081]  ret_from_fork+0x10/0x18
>>> [  410.365395] ---[ end trace 268e87a46c28968c ]---
>>>
>>> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
>>> ---
>>>
>>>   drivers/mmc/core/block.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
>>> index a2b9c25..02485e3 100644
>>> --- a/drivers/mmc/core/block.c
>>> +++ b/drivers/mmc/core/block.c
>>> @@ -2659,7 +2659,6 @@ static void mmc_blk_remove_req(struct mmc_blk_data
>>> *md)
>>>            * from being accepted.
>>>            */
>>>           card = md->queue.card;
>>> -        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) &&
>>> @@ -2669,6 +2668,7 @@ static void mmc_blk_remove_req(struct mmc_blk_data
>>> *md)
>>>                 del_gendisk(md->disk);
>>>           }
>>> +        mmc_cleanup_queue(&md->queue);
>>>           mmc_blk_put(md);
>>>       }
>>>   }
>>>
>>
>>
>>
>>
> 
> 


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] mmc: block: Delete gendisk before cleaning up the request queue
       [not found]             ` <1e104a4a-0508-97ee-4235-12de3e38b417-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2018-03-22  9:47               ` Ulf Hansson
       [not found]                 ` <CAPDyKFrHsg1+3w7iOjKZGCuho-K37PN8Skta_H-uy4dnVMbd9A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Ulf Hansson @ 2018-03-22  9:47 UTC (permalink / raw)
  To: Adrian Hunter, Shawn Lin
  Cc: Jaehoon Chung, open list:ARM/Rockchip SoC...,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA

On 22 March 2018 at 10:31, Adrian Hunter <adrian.hunter-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> On 22/03/18 10:43, Shawn Lin wrote:
>> On 2018/3/22 16:26, Adrian Hunter wrote:
>>> On 22/03/18 09:49, Shawn Lin wrote:
>>>> dd if=/dev/urandom of=/dev/mmcblk1 bs=4k count=10000
>>>> with a SD card hotplug during transfer reports a warning below:
>>>
>>> What kernel version / commit was it?
>>
>> Actually the log below has it, it is clean : 4.16.0-rc6-next-20180321
>
> Ok so it seems to be coming from this patch in next:
>
> commit a063057d7c731cffa7d10740e8ebc2970df8dbb3
> Author: Bart Van Assche <bart.vanassche-Sjgp3cTcYWE@public.gmane.org>
> Date:   Wed Feb 28 10:15:33 2018 -0800
>
>     block: Fix a race between request queue removal and the block cgroup controller
>
>     Avoid that the following race can occur:
>
>     blk_cleanup_queue()               blkcg_print_blkgs()
>       spin_lock_irq(lock) (1)           spin_lock_irq(blkg->q->queue_lock) (2,5)
>         q->queue_lock = &q->__queue_lock (3)
>       spin_unlock_irq(lock) (4)
>                                         spin_unlock_irq(blkg->q->queue_lock) (6)
>
>     (1) take driver lock;
>     (2) busy loop for driver lock;
>     (3) override driver lock with internal lock;
>     (4) unlock driver lock;
>     (5) can take driver lock now;
>     (6) but unlock internal lock.
>
>     This change is safe because only the SCSI core and the NVME core keep
>     a reference on a request queue after having called blk_cleanup_queue().
>     Neither driver accesses any of the removed data structures between its
>     blk_cleanup_queue() and blk_put_queue() calls.
>
>     Reported-by: Joseph Qi <joseph.qi-KPsoFbNs7GizrGE5bRqYAgC/G2K4zDHf@public.gmane.org>
>     Signed-off-by: Bart Van Assche <bart.vanassche-Sjgp3cTcYWE@public.gmane.org>
>     Reviewed-by: Joseph Qi <joseph.qi-KPsoFbNs7GizrGE5bRqYAgC/G2K4zDHf@public.gmane.org>
>     Cc: Jan Kara <jack-IBi9RG/b67k@public.gmane.org>
>     Signed-off-by: Jens Axboe <axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>

Looks like a reasonable analyze!

Shawn, could you please re-post your patch to linux-block, Jens,
cc:mmc-list, me and Adrian.

I think the patch should be picked up by Jens and go via his tree.

Kind regards
Uffe

>
>
>>
>>>
>>>>
>>>> Remove the disk, partition and bdi sysfs attributes before cleaning
>>>> up the request queue associated with the disk.
>>>>
>>>> [  410.331226] mmc1: card 59b4 removed
>>>> [  410.348583] WARNING: CPU: 0 PID: 5 at block/blk-core.c:785
>>>> blk_cleanup_queue+0x138/0x140
>>>> [  410.349294] Modules linked in:
>>>> [  410.349570] CPU: 0 PID: 5 Comm: kworker/0:0 Not tainted
>>>> 4.16.0-rc6-next-20180321-00004-gc2ad6a7 #263
>>>> [  410.350363] Hardware name: Excavator-RK3399 Board (DT)
>>>> [  410.350819] Workqueue: events_freezable mmc_rescan
>>>> [  410.351242] pstate: 60000005 (nZCv daif -PAN -UAO)
>>>> [  410.351663] pc : blk_cleanup_queue+0x138/0x140
>>>> [  410.352054] lr : blk_cleanup_queue+0xac/0x140
>>>> [  410.352436] sp : ffff0000092cbb90
>>>> [  410.352727] x29: ffff0000092cbb90 x28: 0000000000000000
>>>> [  410.353195] x27: ffff8000f6f23030 x26: ffff00000904e610
>>>> [  410.353662] x25: ffff8000f17cc808 x24: ffff8000f1038200
>>>> [  410.354128] x23: 0000000000000060 x22: 0000000000000000
>>>> [  410.354595] x21: ffff8000f11748d8 x20: ffff8000f1038200
>>>> [  410.355061] x19: ffff8000f1174200 x18: 0000ffff936347d8
>>>> [  410.355528] x17: 0000ffff935b93c0 x16: ffff0000081263f8
>>>> [  410.355994] x15: 0000000000000000 x14: 0000000000000400
>>>> [  410.356461] x13: 0000000000000001 x12: 0000000000000001
>>>> [  410.356927] x11: 0000000000000040 x10: ffff8000f2400028
>>>> [  410.357393] x9 : ffff8000f2400040 x8 : 0000000000000000
>>>> [  410.357860] x7 : ffff8000f6f3a340 x6 : ffff8000f6f3a340
>>>> [  410.358326] x5 : ffff8000f2400000 x4 : ffff8000f6f3a340
>>>> [  410.358792] x3 : 0000000000000000 x2 : 39c1333e45670800
>>>> [  410.359259] x1 : 0000000000000000 x0 : 0000000000000003
>>>> [  410.359726] Call trace:
>>>> [  410.359943]  blk_cleanup_queue+0x138/0x140
>>>> [  410.360305]  mmc_cleanup_queue+0x2c/0x48
>>>> [  410.360652]  mmc_blk_remove_req+0x1c/0x98
>>>> [  410.361005]  mmc_blk_remove+0x180/0x1c0
>>>> [  410.361343]  mmc_bus_remove+0x1c/0x28
>>>> [  410.361670]  device_release_driver_internal+0x154/0x1f0
>>>> [  410.362128]  device_release_driver+0x14/0x20
>>>> [  410.362504]  bus_remove_device+0xc8/0x108
>>>> [  410.362858]  device_del+0x120/0x350
>>>> [  410.363167]  mmc_remove_card+0x5c/0xb8
>>>> [  410.363498]  mmc_sd_detect+0x40/0x78
>>>> [  410.363813]  mmc_rescan+0x19c/0x368
>>>> [  410.364123]  process_one_work+0x1ac/0x318
>>>> [  410.364477]  worker_thread+0x50/0x450
>>>> [  410.364801]  kthread+0xf8/0x128
>>>> [  410.365081]  ret_from_fork+0x10/0x18
>>>> [  410.365395] ---[ end trace 268e87a46c28968c ]---
>>>>
>>>> Signed-off-by: Shawn Lin <shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
>>>> ---
>>>>
>>>>   drivers/mmc/core/block.c | 2 +-
>>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
>>>> index a2b9c25..02485e3 100644
>>>> --- a/drivers/mmc/core/block.c
>>>> +++ b/drivers/mmc/core/block.c
>>>> @@ -2659,7 +2659,6 @@ static void mmc_blk_remove_req(struct mmc_blk_data
>>>> *md)
>>>>            * from being accepted.
>>>>            */
>>>>           card = md->queue.card;
>>>> -        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) &&
>>>> @@ -2669,6 +2668,7 @@ static void mmc_blk_remove_req(struct mmc_blk_data
>>>> *md)
>>>>                 del_gendisk(md->disk);
>>>>           }
>>>> +        mmc_cleanup_queue(&md->queue);
>>>>           mmc_blk_put(md);
>>>>       }
>>>>   }
>>>>
>>>
>>>
>>>
>>>
>>
>>
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] mmc: block: Delete gendisk before cleaning up the request queue
       [not found]                 ` <CAPDyKFrHsg1+3w7iOjKZGCuho-K37PN8Skta_H-uy4dnVMbd9A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2018-03-22 11:04                   ` Shawn Lin
  0 siblings, 0 replies; 9+ messages in thread
From: Shawn Lin @ 2018-03-22 11:04 UTC (permalink / raw)
  To: Ulf Hansson, Adrian Hunter
  Cc: Jaehoon Chung, open list:ARM/Rockchip SoC...,
	shawn.lin-TNX95d0MmH7DzftRWevZcw,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA

在 2018/3/22 17:47, Ulf Hansson 写道:
> On 22 March 2018 at 10:31, Adrian Hunter <adrian.hunter@intel.com> wrote:
>> On 22/03/18 10:43, Shawn Lin wrote:
>>> On 2018/3/22 16:26, Adrian Hunter wrote:
>>>> On 22/03/18 09:49, Shawn Lin wrote:
>>>>> dd if=/dev/urandom of=/dev/mmcblk1 bs=4k count=10000
>>>>> with a SD card hotplug during transfer reports a warning below:
>>>>
>>>> What kernel version / commit was it?
>>>
>>> Actually the log below has it, it is clean : 4.16.0-rc6-next-20180321
>>
>> Ok so it seems to be coming from this patch in next:
>>
>> commit a063057d7c731cffa7d10740e8ebc2970df8dbb3
>> Author: Bart Van Assche <bart.vanassche@wdc.com>
>> Date:   Wed Feb 28 10:15:33 2018 -0800
>>
>>      block: Fix a race between request queue removal and the block cgroup controller
>>
>>      Avoid that the following race can occur:
>>
>>      blk_cleanup_queue()               blkcg_print_blkgs()
>>        spin_lock_irq(lock) (1)           spin_lock_irq(blkg->q->queue_lock) (2,5)
>>          q->queue_lock = &q->__queue_lock (3)
>>        spin_unlock_irq(lock) (4)
>>                                          spin_unlock_irq(blkg->q->queue_lock) (6)
>>
>>      (1) take driver lock;
>>      (2) busy loop for driver lock;
>>      (3) override driver lock with internal lock;
>>      (4) unlock driver lock;
>>      (5) can take driver lock now;
>>      (6) but unlock internal lock.
>>
>>      This change is safe because only the SCSI core and the NVME core keep
>>      a reference on a request queue after having called blk_cleanup_queue().
>>      Neither driver accesses any of the removed data structures between its
>>      blk_cleanup_queue() and blk_put_queue() calls.
>>
>>      Reported-by: Joseph Qi <joseph.qi@linux.alibaba.com>
>>      Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
>>      Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
>>      Cc: Jan Kara <jack@suse.com>
>>      Signed-off-by: Jens Axboe <axboe@kernel.dk>
> 
> Looks like a reasonable analyze!
> 
> Shawn, could you please re-post your patch to linux-block, Jens,
> cc:mmc-list, me and Adrian.
> 

Sure, I have sent to Jens.

> I think the patch should be picked up by Jens and go via his tree.
> 
> Kind regards
> Uffe
> 
>>
>>
>>>
>>>>
>>>>>
>>>>> Remove the disk, partition and bdi sysfs attributes before cleaning
>>>>> up the request queue associated with the disk.
>>>>>
>>>>> [  410.331226] mmc1: card 59b4 removed
>>>>> [  410.348583] WARNING: CPU: 0 PID: 5 at block/blk-core.c:785
>>>>> blk_cleanup_queue+0x138/0x140
>>>>> [  410.349294] Modules linked in:
>>>>> [  410.349570] CPU: 0 PID: 5 Comm: kworker/0:0 Not tainted
>>>>> 4.16.0-rc6-next-20180321-00004-gc2ad6a7 #263
>>>>> [  410.350363] Hardware name: Excavator-RK3399 Board (DT)
>>>>> [  410.350819] Workqueue: events_freezable mmc_rescan
>>>>> [  410.351242] pstate: 60000005 (nZCv daif -PAN -UAO)
>>>>> [  410.351663] pc : blk_cleanup_queue+0x138/0x140
>>>>> [  410.352054] lr : blk_cleanup_queue+0xac/0x140
>>>>> [  410.352436] sp : ffff0000092cbb90
>>>>> [  410.352727] x29: ffff0000092cbb90 x28: 0000000000000000
>>>>> [  410.353195] x27: ffff8000f6f23030 x26: ffff00000904e610
>>>>> [  410.353662] x25: ffff8000f17cc808 x24: ffff8000f1038200
>>>>> [  410.354128] x23: 0000000000000060 x22: 0000000000000000
>>>>> [  410.354595] x21: ffff8000f11748d8 x20: ffff8000f1038200
>>>>> [  410.355061] x19: ffff8000f1174200 x18: 0000ffff936347d8
>>>>> [  410.355528] x17: 0000ffff935b93c0 x16: ffff0000081263f8
>>>>> [  410.355994] x15: 0000000000000000 x14: 0000000000000400
>>>>> [  410.356461] x13: 0000000000000001 x12: 0000000000000001
>>>>> [  410.356927] x11: 0000000000000040 x10: ffff8000f2400028
>>>>> [  410.357393] x9 : ffff8000f2400040 x8 : 0000000000000000
>>>>> [  410.357860] x7 : ffff8000f6f3a340 x6 : ffff8000f6f3a340
>>>>> [  410.358326] x5 : ffff8000f2400000 x4 : ffff8000f6f3a340
>>>>> [  410.358792] x3 : 0000000000000000 x2 : 39c1333e45670800
>>>>> [  410.359259] x1 : 0000000000000000 x0 : 0000000000000003
>>>>> [  410.359726] Call trace:
>>>>> [  410.359943]  blk_cleanup_queue+0x138/0x140
>>>>> [  410.360305]  mmc_cleanup_queue+0x2c/0x48
>>>>> [  410.360652]  mmc_blk_remove_req+0x1c/0x98
>>>>> [  410.361005]  mmc_blk_remove+0x180/0x1c0
>>>>> [  410.361343]  mmc_bus_remove+0x1c/0x28
>>>>> [  410.361670]  device_release_driver_internal+0x154/0x1f0
>>>>> [  410.362128]  device_release_driver+0x14/0x20
>>>>> [  410.362504]  bus_remove_device+0xc8/0x108
>>>>> [  410.362858]  device_del+0x120/0x350
>>>>> [  410.363167]  mmc_remove_card+0x5c/0xb8
>>>>> [  410.363498]  mmc_sd_detect+0x40/0x78
>>>>> [  410.363813]  mmc_rescan+0x19c/0x368
>>>>> [  410.364123]  process_one_work+0x1ac/0x318
>>>>> [  410.364477]  worker_thread+0x50/0x450
>>>>> [  410.364801]  kthread+0xf8/0x128
>>>>> [  410.365081]  ret_from_fork+0x10/0x18
>>>>> [  410.365395] ---[ end trace 268e87a46c28968c ]---
>>>>>
>>>>> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
>>>>> ---
>>>>>
>>>>>    drivers/mmc/core/block.c | 2 +-
>>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
>>>>> index a2b9c25..02485e3 100644
>>>>> --- a/drivers/mmc/core/block.c
>>>>> +++ b/drivers/mmc/core/block.c
>>>>> @@ -2659,7 +2659,6 @@ static void mmc_blk_remove_req(struct mmc_blk_data
>>>>> *md)
>>>>>             * from being accepted.
>>>>>             */
>>>>>            card = md->queue.card;
>>>>> -        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) &&
>>>>> @@ -2669,6 +2668,7 @@ static void mmc_blk_remove_req(struct mmc_blk_data
>>>>> *md)
>>>>>                  del_gendisk(md->disk);
>>>>>            }
>>>>> +        mmc_cleanup_queue(&md->queue);
>>>>>            mmc_blk_put(md);
>>>>>        }
>>>>>    }
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> 


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] mmc: block: Delete gendisk before cleaning up the request queue
  2018-03-22 16:59 ` Bart Van Assche
@ 2018-03-22 17:05   ` Jens Axboe
  0 siblings, 0 replies; 9+ messages in thread
From: Jens Axboe @ 2018-03-22 17:05 UTC (permalink / raw)
  To: Bart Van Assche, shawn.lin
  Cc: ulf.hansson, linux-mmc, linux-block, adrian.hunter

On 3/22/18 10:59 AM, Bart Van Assche wrote:
> On Thu, 2018-03-22 at 18:56 +0800, Shawn Lin wrote:
>> dd if=/dev/urandom of=/dev/mmcblk1 bs=4k count=10000
>> with a SD card hotplug during transfer reports a warning below
>> introduced by commit a063057d7c73 ("block: Fix a race between
>> request queue removal and the block cgroup controller"). So we
>> should now remove the disk, partition and bdi sysfs attributes
>> before cleaning up the request queue associated with the disk.
> 
> Since del_gendisk() may submit I/O calling blk_cleanup_queue() before
> del_gendisk() has never been safe so this requirement is not really new.
> Anyway, thanks for this patch.

Indeed, it has always been so. In any case, patch does look good,
applied.


-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] mmc: block: Delete gendisk before cleaning up the request queue
  2018-03-22 10:56 Shawn Lin
@ 2018-03-22 16:59 ` Bart Van Assche
  2018-03-22 17:05   ` Jens Axboe
  0 siblings, 1 reply; 9+ messages in thread
From: Bart Van Assche @ 2018-03-22 16:59 UTC (permalink / raw)
  To: shawn.lin, axboe; +Cc: ulf.hansson, linux-mmc, linux-block, adrian.hunter

T24gVGh1LCAyMDE4LTAzLTIyIGF0IDE4OjU2ICswODAwLCBTaGF3biBMaW4gd3JvdGU6DQo+IGRk
IGlmPS9kZXYvdXJhbmRvbSBvZj0vZGV2L21tY2JsazEgYnM9NGsgY291bnQ9MTAwMDANCj4gd2l0
aCBhIFNEIGNhcmQgaG90cGx1ZyBkdXJpbmcgdHJhbnNmZXIgcmVwb3J0cyBhIHdhcm5pbmcgYmVs
b3cNCj4gaW50cm9kdWNlZCBieSBjb21taXQgYTA2MzA1N2Q3YzczICgiYmxvY2s6IEZpeCBhIHJh
Y2UgYmV0d2Vlbg0KPiByZXF1ZXN0IHF1ZXVlIHJlbW92YWwgYW5kIHRoZSBibG9jayBjZ3JvdXAg
Y29udHJvbGxlciIpLiBTbyB3ZQ0KPiBzaG91bGQgbm93IHJlbW92ZSB0aGUgZGlzaywgcGFydGl0
aW9uIGFuZCBiZGkgc3lzZnMgYXR0cmlidXRlcw0KPiBiZWZvcmUgY2xlYW5pbmcgdXAgdGhlIHJl
cXVlc3QgcXVldWUgYXNzb2NpYXRlZCB3aXRoIHRoZSBkaXNrLg0KDQpTaW5jZSBkZWxfZ2VuZGlz
aygpIG1heSBzdWJtaXQgSS9PIGNhbGxpbmcgYmxrX2NsZWFudXBfcXVldWUoKSBiZWZvcmUNCmRl
bF9nZW5kaXNrKCkgaGFzIG5ldmVyIGJlZW4gc2FmZSBzbyB0aGlzIHJlcXVpcmVtZW50IGlzIG5v
dCByZWFsbHkgbmV3Lg0KQW55d2F5LCB0aGFua3MgZm9yIHRoaXMgcGF0Y2guDQoNClJldmlld2Vk
LWJ5OiBCYXJ0IFZhbiBBc3NjaGUgPGJhcnQudmFuYXNzY2hlQHdkYy5jb20+DQoNCg0K

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] mmc: block: Delete gendisk before cleaning up the request queue
@ 2018-03-22 10:56 Shawn Lin
  2018-03-22 16:59 ` Bart Van Assche
  0 siblings, 1 reply; 9+ messages in thread
From: Shawn Lin @ 2018-03-22 10:56 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Ulf Hansson, Bart Van Assche, linux-mmc,
	Adrian Hunter, Shawn Lin

dd if=/dev/urandom of=/dev/mmcblk1 bs=4k count=10000
with a SD card hotplug during transfer reports a warning below
introduced by commit a063057d7c73 ("block: Fix a race between
request queue removal and the block cgroup controller"). So we
should now remove the disk, partition and bdi sysfs attributes
before cleaning up the request queue associated with the disk.

[  410.331226] mmc1: card 59b4 removed
[  410.348583] WARNING: CPU: 0 PID: 5 at block/blk-core.c:785
blk_cleanup_queue+0x138/0x140
[  410.349294] Modules linked in:
[  410.349570] CPU: 0 PID: 5 Comm: kworker/0:0 Not tainted
4.16.0-rc6-next-20180321-00004-gc2ad6a7 #263
[  410.350363] Hardware name: Excavator-RK3399 Board (DT)
[  410.350819] Workqueue: events_freezable mmc_rescan
[  410.351242] pstate: 60000005 (nZCv daif -PAN -UAO)
[  410.351663] pc : blk_cleanup_queue+0x138/0x140
[  410.352054] lr : blk_cleanup_queue+0xac/0x140
[  410.352436] sp : ffff0000092cbb90
[  410.352727] x29: ffff0000092cbb90 x28: 0000000000000000
[  410.353195] x27: ffff8000f6f23030 x26: ffff00000904e610
[  410.353662] x25: ffff8000f17cc808 x24: ffff8000f1038200
[  410.354128] x23: 0000000000000060 x22: 0000000000000000
[  410.354595] x21: ffff8000f11748d8 x20: ffff8000f1038200
[  410.355061] x19: ffff8000f1174200 x18: 0000ffff936347d8
[  410.355528] x17: 0000ffff935b93c0 x16: ffff0000081263f8
[  410.355994] x15: 0000000000000000 x14: 0000000000000400
[  410.356461] x13: 0000000000000001 x12: 0000000000000001
[  410.356927] x11: 0000000000000040 x10: ffff8000f2400028
[  410.357393] x9 : ffff8000f2400040 x8 : 0000000000000000
[  410.357860] x7 : ffff8000f6f3a340 x6 : ffff8000f6f3a340
[  410.358326] x5 : ffff8000f2400000 x4 : ffff8000f6f3a340
[  410.358792] x3 : 0000000000000000 x2 : 39c1333e45670800
[  410.359259] x1 : 0000000000000000 x0 : 0000000000000003
[  410.359726] Call trace:
[  410.359943]  blk_cleanup_queue+0x138/0x140
[  410.360305]  mmc_cleanup_queue+0x2c/0x48
[  410.360652]  mmc_blk_remove_req+0x1c/0x98
[  410.361005]  mmc_blk_remove+0x180/0x1c0
[  410.361343]  mmc_bus_remove+0x1c/0x28
[  410.361670]  device_release_driver_internal+0x154/0x1f0
[  410.362128]  device_release_driver+0x14/0x20
[  410.362504]  bus_remove_device+0xc8/0x108
[  410.362858]  device_del+0x120/0x350
[  410.363167]  mmc_remove_card+0x5c/0xb8
[  410.363498]  mmc_sd_detect+0x40/0x78
[  410.363813]  mmc_rescan+0x19c/0x368
[  410.364123]  process_one_work+0x1ac/0x318
[  410.364477]  worker_thread+0x50/0x450
[  410.364801]  kthread+0xf8/0x128
[  410.365081]  ret_from_fork+0x10/0x18
[  410.365395] ---[ end trace 268e87a46c28968c ]---

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

 drivers/mmc/core/block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index a2b9c25..02485e3 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -2659,7 +2659,6 @@ static void mmc_blk_remove_req(struct mmc_blk_data *md)
 		 * from being accepted.
 		 */
 		card = md->queue.card;
-		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) &&
@@ -2669,6 +2668,7 @@ static void mmc_blk_remove_req(struct mmc_blk_data *md)
 
 			del_gendisk(md->disk);
 		}
+		mmc_cleanup_queue(&md->queue);
 		mmc_blk_put(md);
 	}
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-03-22 17:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-22  7:49 [PATCH] mmc: block: Delete gendisk before cleaning up the request queue Shawn Lin
     [not found] ` <1521704940-45406-1-git-send-email-shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2018-03-22  8:26   ` Adrian Hunter
     [not found]     ` <f1c54ab8-aa38-69bc-b55a-fd8decc67d2d-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2018-03-22  8:43       ` Shawn Lin
     [not found]         ` <ba973085-9321-c782-2eb1-68a1ff67366c-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2018-03-22  9:31           ` Adrian Hunter
     [not found]             ` <1e104a4a-0508-97ee-4235-12de3e38b417-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2018-03-22  9:47               ` Ulf Hansson
     [not found]                 ` <CAPDyKFrHsg1+3w7iOjKZGCuho-K37PN8Skta_H-uy4dnVMbd9A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-03-22 11:04                   ` Shawn Lin
2018-03-22 10:56 Shawn Lin
2018-03-22 16:59 ` Bart Van Assche
2018-03-22 17:05   ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.