* [PATCH 0/2] fs: Fixup bdev_mark_dead callbacks for ext4 and xfs
@ 2023-06-21 14:47 Jan Kara
2023-06-21 14:47 ` [PATCH 1/2] ext4: Fix crash in ext4_bdev_mark_dead() Jan Kara
2023-06-21 14:47 ` [PATCH 2/2] xfs: " Jan Kara
0 siblings, 2 replies; 6+ messages in thread
From: Jan Kara @ 2023-06-21 14:47 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-block, Christoph Hellwig, linux-ext4, linux-xfs, Jan Kara
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] ext4: Fix crash in ext4_bdev_mark_dead()
2023-06-21 14:47 [PATCH 0/2] fs: Fixup bdev_mark_dead callbacks for ext4 and xfs Jan Kara
@ 2023-06-21 14:47 ` Jan Kara
2023-06-21 14:52 ` Christoph Hellwig
2023-06-21 14:47 ` [PATCH 2/2] xfs: " Jan Kara
1 sibling, 1 reply; 6+ messages in thread
From: Jan Kara @ 2023-06-21 14:47 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-block, Christoph Hellwig, linux-ext4, linux-xfs, Jan Kara
ext4_bdev_mark_dead() passes bdev->bd_holder to ext4_force_shutdown()
instead of bdev->bd_super leading to crashes. Fix it.
Fixes: dd2e31afba9e ("ext4: wire up the ->mark_dead holder operation for log devices")
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/ext4/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 6f43a86ecf16..53d74144ee34 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -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 = {
--
2.35.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] xfs: Fix crash in ext4_bdev_mark_dead()
2023-06-21 14:47 [PATCH 0/2] fs: Fixup bdev_mark_dead callbacks for ext4 and xfs Jan Kara
2023-06-21 14:47 ` [PATCH 1/2] ext4: Fix crash in ext4_bdev_mark_dead() Jan Kara
@ 2023-06-21 14:47 ` Jan Kara
2023-06-21 14:53 ` Christoph Hellwig
1 sibling, 1 reply; 6+ messages in thread
From: Jan Kara @ 2023-06-21 14:47 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-block, Christoph Hellwig, linux-ext4, linux-xfs, Jan Kara
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(-)
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 = {
--
2.35.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] ext4: Fix crash in ext4_bdev_mark_dead()
2023-06-21 14:47 ` [PATCH 1/2] ext4: Fix crash in ext4_bdev_mark_dead() Jan Kara
@ 2023-06-21 14:52 ` Christoph Hellwig
2023-06-21 16:26 ` Jan Kara
0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2023-06-21 14:52 UTC (permalink / raw)
To: Jan Kara
Cc: Jens Axboe, linux-block, Christoph Hellwig, linux-ext4, linux-xfs
On Wed, Jun 21, 2023 at 04:47:42PM +0200, Jan Kara wrote:
> ext4_bdev_mark_dead() passes bdev->bd_holder to ext4_force_shutdown()
> instead of bdev->bd_super leading 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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] xfs: Fix crash in ext4_bdev_mark_dead()
2023-06-21 14:47 ` [PATCH 2/2] xfs: " Jan Kara
@ 2023-06-21 14:53 ` Christoph Hellwig
0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2023-06-21 14:53 UTC (permalink / raw)
To: Jan Kara
Cc: Jens Axboe, linux-block, Christoph Hellwig, linux-ext4, linux-xfs
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] ext4: Fix crash in ext4_bdev_mark_dead()
2023-06-21 14:52 ` Christoph Hellwig
@ 2023-06-21 16:26 ` Jan Kara
0 siblings, 0 replies; 6+ messages in thread
From: Jan Kara @ 2023-06-21 16:26 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jan Kara, Jens Axboe, linux-block, linux-ext4, linux-xfs
On Wed 21-06-23 07:52:27, Christoph Hellwig wrote:
> On Wed, Jun 21, 2023 at 04:47:42PM +0200, Jan Kara wrote:
> > ext4_bdev_mark_dead() passes bdev->bd_holder to ext4_force_shutdown()
> > instead of bdev->bd_super leading 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.
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
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-06-21 16:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-21 14:47 [PATCH 0/2] fs: Fixup bdev_mark_dead callbacks for ext4 and xfs Jan Kara
2023-06-21 14:47 ` [PATCH 1/2] ext4: Fix crash in ext4_bdev_mark_dead() Jan Kara
2023-06-21 14:52 ` Christoph Hellwig
2023-06-21 16:26 ` Jan Kara
2023-06-21 14:47 ` [PATCH 2/2] xfs: " Jan Kara
2023-06-21 14:53 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox