mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-15 08:44:14 +08:00
nbd: call blk_mark_disk_dead in nbd_clear_sock_ioctl
nbd_clear_sock_ioctl kills the socket and with that the block device. Instead of just invalidating file system buffers, mark the device as dead, which will also invalidate the buffers as part of the proper shutdown sequence. This also includes invalidating partitions if there are any. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Josef Bacik <josef@toxicpanda.com> Message-Id: <20230811100828.1897174-8-hch@lst.de> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
8ffa54e337
commit
0c1c9a27ce
@ -1434,12 +1434,10 @@ static int nbd_start_device_ioctl(struct nbd_device *nbd)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void nbd_clear_sock_ioctl(struct nbd_device *nbd,
|
||||
struct block_device *bdev)
|
||||
static void nbd_clear_sock_ioctl(struct nbd_device *nbd)
|
||||
{
|
||||
blk_mark_disk_dead(nbd->disk);
|
||||
nbd_clear_sock(nbd);
|
||||
__invalidate_device(bdev, true);
|
||||
nbd_bdev_reset(nbd);
|
||||
if (test_and_clear_bit(NBD_RT_HAS_CONFIG_REF,
|
||||
&nbd->config->runtime_flags))
|
||||
nbd_config_put(nbd);
|
||||
@ -1465,7 +1463,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
|
||||
case NBD_DISCONNECT:
|
||||
return nbd_disconnect(nbd);
|
||||
case NBD_CLEAR_SOCK:
|
||||
nbd_clear_sock_ioctl(nbd, bdev);
|
||||
nbd_clear_sock_ioctl(nbd);
|
||||
return 0;
|
||||
case NBD_SET_SOCK:
|
||||
return nbd_add_socket(nbd, arg, false);
|
||||
|
Loading…
Reference in New Issue
Block a user