md read-only fixes
Subsystems (2)
Hi all,
patch 1 fixes a regression in md in for-5.12/block, and patch 2 fixes a little inconsistency in the same area.
PATCH 1/2 md: check for NULL ->meta_bdev before calling bdev_read_only
->meta_bdev is optional and not set for most arrays. Add a rdev_read_only helper that calls bdev_read_only for both devices in a safe way.
--- drivers/md/md.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/md/md.c +8 -5
@@ -2399,6 +2399,12 @@ int md_integrity_add_rdev(struct md_rdev *rdev, struct mddev *mddev) }EXPORT_SYMBOL (md_integrity_add_rdev); +static bool rdev_read_only (struct md_rdev *rdev) +{ +return bdev_read_only (rdev->bdev) || + (rdev->meta_bdev &&bdev_read_only (rdev->meta_bdev)); +} +static int bind_rdev_to_array (struct md_rdev *rdev,struct mddev *mddev) {char b[BDEVNAME_SIZE ];
@@ -2408,8 +2414,7 @@ static int bind_rdev_to_array(struct md_rdev *rdev, struct mddev *mddev)if (find_rdev (mddev, rdev->bdev->bd_dev))return -EEXIST ; -if ((bdev_read_only (rdev->bdev) ||bdev_read_only (rdev->meta_bdev)) && - mddev->pers) +if (rdev_read_only (rdev) && mddev->pers)return -EROFS ;/* make sure rdev->sectors exceeds mddev->dev_sectors */
@@ -5843,9 +5848,7 @@ int md_run(struct mddev *mddev)continue ;sync_blockdev (rdev->bdev);invalidate_bdev (rdev->bdev); -if (mddev->ro !=1 && - (bdev_read_only (rdev->bdev) || -bdev_read_only (rdev->meta_bdev))) { +if (mddev->ro !=1 &&rdev_read_only (rdev)) { mddev->ro =1 ;if (mddev->gendisk)set_disk_ro (mddev->gendisk,1 );
Signature · 1 line
2.29.2
PATCH 2/2 md: use rdev_read_only in restart_array
In reply to Christoph HellwigMake the read-only check in restart_array identical to the other two read-only checks.
--- drivers/md/md.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/md.c +1 -1
@@ -6143,7 +6143,7 @@ static int restart_array(struct mddev *mddev)if (test_bit (Journal, &rdev->flags) && !test_bit (Faulty, &rdev->flags)) has_journal = true; -if (bdev_read_only (rdev->bdev)) +if (rdev_read_only (rdev)) has_readonly = true; }rcu_read_unlock ();
Signature · 1 line
2.29.2
Quoted 4 lines · Christoph Hellwig
Hi all,
patch 1 fixes a regression in md in for-5.12/block, and patch 2 fixes a little inconsistency in the same area.
Applied, thanks.
Signature · 1 line
Jens Axboe
Quoted 8 lines · Jens Axboe
Quoted 4 lines · Christoph Hellwig
Hi all,
patch 1 fixes a regression in md in for-5.12/block, and patch 2 fixes a little inconsistency in the same area.
Applied, thanks.
Hi Song,
Could you cherry-pick those fixes? The issue blocks our daily tests.
Thanks,
Mariusz
Song Liu
maintainerQuoted 5 lines · Mariusz
Quoted 3 lines · Jens Axboe
Quoted 2 lines · Christoph Hellwig
Hi all,
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
patch 1 fixes a regression in md in for-5.12/block, and patch 2 fixes a little inconsistency in the same area.
Applied, thanks.
Hi Song,
Could you cherry-pick those fixes? The issue blocks our daily tests.
I rebased md-next on top of Linus' master branch. Could you please try the tests?
Thanks,
Song