dm missing bdput/thaw_bdev at removal
PATCH 1/1 dm missing bdput/thaw_bdev at removal
Hello,
The following script stalls at the 2nd suspend. It's because bdput() isn't called for the suspended_bdev.
So the inode with bd_mount_sem held is just reused in the next mapped_device device.
Then dm_suspend will try to freeze_bdev and wait forever.
Attached patch fixes this problem.
------------------------------------------------------------
#!/bin/sh -x
map=a
while true; do
dmsetup create $map --notable
dmsetup suspend $map
dmsetup remove $map
done
------------------------------------------------------------
Signature · 1 line
Jun'ichi Nomura, NEC Solutions (America), Inc.
Need to unfreeze and release bdev
otherwise the bdev inode with inconsistent state is reused later and cause problem.
drivers/md/dm.c +4 -0
@@ -812,6 +812,10 @@ static struct mapped_device *alloc_dev(ustatic void free_dev (struct mapped_device *md) { +if (md->suspended_bdev) { +thaw_bdev (md->suspended_bdev,NULL ); +bdput (md->suspended_bdev); + }free_minor (md->disk->first_minor);mempool_destroy (md->tio_pool);mempool_destroy (md->io_pool);
Alasdair G Kergon
maintainerQuoted 3 lines · Jun'ichi Nomura
Then
dm_suspendwill try tofreeze_bdevand wait forever.Attached patch fixes this problem.
Indeed - well spotted!
Alasdair
Signature · 1 line
[email protected]
Would this explain the trouble I was having with mirroring and lock_fs?
brassow
Quoted 16 lines · Alasdair G Kergon
Quoted 3 lines · Jun'ichi Nomura
Then
dm_suspendwill try tofreeze_bdevand wait forever.Attached patch fixes this problem.
Indeed - well spotted!
Alasdair
Signature · 6 lines
[email protected] -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
Alasdair G Kergon
maintainerQuoted 1 line · Jon Brassow
Would this explain the trouble I was having with mirroring and
lock_fs?
Quite possibly - this one caused problems based on *previous* actions which you wouldn't normally have thought to associate with the problem being investigated.
Alasdair
Signature · 1 line
[email protected]