diff options
author | Christoph Hellwig <hch@lst.de> | 2023-06-01 11:44:56 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-06-05 10:53:04 -0600 |
commit | 8067ca1dcdfcc2a5e0a51bff3730ad3eef0623d6 (patch) | |
tree | 7a885bdaebb79884a272480e93e2c12395595457 /fs/xfs | |
parent | e7caa877e5ddac63886f4a8376cb3ffbd4dfe569 (diff) |
xfs: wire up the ->mark_dead holder operation for log and RT devices
Implement a set of holder_ops that shut down the file system when the
block device used as log or RT device is removed undeneath the file
system.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Acked-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Link: https://lore.kernel.org/r/20230601094459.1350643-14-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_super.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index eb469b8f9a04..1b4bd5c88f4a 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -377,6 +377,17 @@ disable_dax: return 0; } +static void +xfs_bdev_mark_dead( + struct block_device *bdev) +{ + xfs_force_shutdown(bdev->bd_holder, SHUTDOWN_DEVICE_REMOVED); +} + +static const struct blk_holder_ops xfs_holder_ops = { + .mark_dead = xfs_bdev_mark_dead, +}; + STATIC int xfs_blkdev_get( xfs_mount_t *mp, @@ -386,7 +397,7 @@ xfs_blkdev_get( int error = 0; *bdevp = blkdev_get_by_path(name, FMODE_READ|FMODE_WRITE|FMODE_EXCL, - mp, NULL); + mp, &xfs_holder_ops); if (IS_ERR(*bdevp)) { error = PTR_ERR(*bdevp); xfs_warn(mp, "Invalid device [%s], error=%d", name, error); |