fs: Fixup bdev_mark_dead callbacks for ext4 and xfs
Subsystems (3)
Jan Kara
reviewercover fs: Fixup bdev_mark_dead callbacks for ext4 and xfs
Hello,
Jens, I have found out the recently added handlers (sitting in your tree) of .bdev_mark_dead callbacks in xfs and ext4 were wrongly using bdev->bd_holder instead of bdev->bd_super and so they could never work. This series fixes them.
Honza
Jan Kara
reviewerPATCH 1/2 ext4: Fix crash in ext4_bdev_mark_dead()
ext4_bdev_mark_dead() passes bdev->bd_holder to ext4_force_shutdown() instead of bdev->bd_super leading to crashes. Fix it.
--- fs/ext4/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/super.c +1 -1
@@ -1098,7 +1098,7 @@ void ext4_update_dynamic_rev(struct super_block *sb)static void ext4_bdev_mark_dead (struct block_device *bdev) { -ext4_force_shutdown (bdev->bd_holder,EXT4_GOING_FLAGS_NOLOGFLUSH ); +ext4_force_shutdown (bdev->bd_super,EXT4_GOING_FLAGS_NOLOGFLUSH ); }static const struct blk_holder_ops ext4_holder_ops = {
Signature · 1 line
2.35.3
Re: [PATCH 1/2] ext4: Fix crash in ext4_bdev_mark_dead()
Quoted 2 lines · Jan Kara
ext4_bdev_mark_dead()passesbdev->bd_holdertoext4_force_shutdown()instead ofbdev->bd_superleading to crashes. Fix it.
How does this crash? ext4_blkdev_get passes the sb as holder, and I actually tested this code.
This is not to be confused with the blkdev_get_by_path in get_tree_bdev, but that never ends up in ext4_bdev_mark_dead.
Jan Kara
reviewerRe: [PATCH 1/2] ext4: Fix crash in ext4_bdev_mark_dead()
Quoted 9 lines · Christoph Hellwig
Quoted 2 lines · Jan Kara
ext4_bdev_mark_dead()passesbdev->bd_holdertoext4_force_shutdown()instead ofbdev->bd_superleading to crashes. Fix it.How does this crash?
ext4_blkdev_getpasses the sb as holder, and I actually tested this code.This is not to be confused with the
blkdev_get_by_pathinget_tree_bdev, but that never ends up inext4_bdev_mark_dead.
Indeed, I have confused the method called for journal device with the method called for the main filesystem device. Both my patches are wrong and I'm sorry for the confusion!
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Jan Kara
reviewerPATCH 2/2 xfs: Fix crash in ext4_bdev_mark_dead()
In reply to Jan Karaxfs_bdev_mark_dead() passes bdev->bd_holder to ext4_force_shutdown() instead of bdev->bd_super leading to crashes. Fix it.
--- fs/xfs/xfs_super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_super.c +1 -1
@@ -381,7 +381,7 @@ static voidxfs_bdev_mark_dead ( struct block_device *bdev) { -xfs_force_shutdown (bdev->bd_holder,SHUTDOWN_DEVICE_REMOVED ); +xfs_force_shutdown (XFS_M (bdev->bd_super),SHUTDOWN_DEVICE_REMOVED ); }static const struct blk_holder_ops xfs_holder_ops = {
Signature · 1 line
2.35.3
Re: [PATCH 2/2] xfs: Fix crash in ext4_bdev_mark_dead()
Quoted 2 lines · Jan Kara
xfs_bdev_mark_dead()passesbdev->bd_holdertoext4_force_shutdown()instead ofbdev->bd_superleading to crashes. Fix it.
xfs_bdev_mark_dead is only called for the log and RT devices, for which the mp is passed as holder to blkdev_get_by_path. bd_super won't be set for those devices, so this patch will introduce a crash and not fix one.