diff mbox series

[2/2] xfs: Fix crash in ext4_bdev_mark_dead()

Message ID 20230621144744.1580-2-jack@suse.cz
State New
Headers show
Series fs: Fixup bdev_mark_dead callbacks for ext4 and xfs | expand

Commit Message

Jan Kara June 21, 2023, 2:47 p.m. UTC
xfs_bdev_mark_dead() passes bdev->bd_holder to ext4_force_shutdown()
instead of bdev->bd_super leading to crashes. Fix it.

Fixes: 8067ca1dcdfc ("xfs: wire up the ->mark_dead holder operation for log and RT devices")
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/xfs/xfs_super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christoph Hellwig June 21, 2023, 2:53 p.m. UTC | #1
On Wed, Jun 21, 2023 at 04:47:43PM +0200, Jan Kara wrote:
> xfs_bdev_mark_dead() passes bdev->bd_holder to ext4_force_shutdown()
> instead of bdev->bd_super leading 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.
diff mbox series

Patch

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index d910b141d52e..3ab188a6fba1 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -381,7 +381,7 @@  static void
 xfs_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 = {