Commit 8067ca1d authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Acked-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Link: https://lore.kernel.org/r/20230601094459.1350643-14-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent e7caa877
......@@ -377,6 +377,17 @@ xfs_setup_dax_always(
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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment