# Re: tear down file system I/O in del\_gendisk v3

- From: Yi Zhang \<hidden\>
- Date: 2021-10-14 09:23:40 
- List: linux-block
- Page: https://ratatoskr.run/linux-block/2021/10/6406026
- Thread: https://ratatoskr.run/linux-block/2021/09/6405723/t.md

```text
This patchset fixed the NULL pointer issue triggered by blktests block/025
https://lore.kernel.org/linux-block/YWfJ06KX3HT1nANX@infradead.org/T/#mbf26cd34c88660ce0221dd7933b294a0b0298319

Tested-by: Yi Zhang <redacted>

On Wed, Sep 29, 2021 at 3:14 PM Christoph Hellwig [ref] wrote:
>
> Ming reported that for SCSI we have a lifetime problem now that
> the BDI moved from the request_queue to the disk as del_gendisk
> doesn't finish all outstanding file system I/O.  It turns out
> this actually is an older problem, although the case where it could
> be hit before was very unusual (unbinding of a SCSI upper driver
> while the scsi_device stays around).  This series fixes this by
> draining all I/O in del_gendisk.
>
> Changes since v2:
>  - move the call to submit_bio_checks into freeze protection
>
> Changes since v1:
>  - fix a commit log typo
>  - keep the existing nowait vs queue dying semantics in bio_queue_enter
>  - actually keep q_usage_counter in atomic mode after del_gendisk
>


-- 
Best Regards,
  Yi Zhang

```
