On 2023-10-03 10:31 AM, Christoph Hellwig wrote: > blk_mark_disk_dead is the proper interface to shut down a block > device, but it also makes the disk unusable forever. > > nbd_clear_sock_ioctl on the other hand wants to shut down the file > system, but allow the block device to be used again when when connected > to another socket. Switch nbd to use disk_force_media_change and > nbd_bdev_reset to go back to a behavior of the old __invalidate_device > call, with the added benefit of incrementing the device generation > as there is no guarantee the old content comes back when the device > is reconnected. > > Reported-by: Samuel Holland <samuel.holland@xxxxxxxxxx> > Reported-by: Shinichiro Kawasaki <shinichiro.kawasaki@xxxxxxx> > Fixes: 0c1c9a27ce90 ("nbd: call blk_mark_disk_dead in nbd_clear_sock_ioctl") > Signed-off-by: Christoph Hellwig <hch@xxxxxx> > --- > drivers/block/nbd.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) Tested-by: Samuel Holland <samuel.holland@xxxxxxxxxx> Thanks for the fix!