diff mbox

fix mirror device creation with lvcreate failed

Message ID 20140917111555.0e8df37f@notabene.brown (mailing list archive)
State Not Applicable, archived
Delegated to: Mike Snitzer
Headers show

Commit Message

NeilBrown Sept. 17, 2014, 1:15 a.m. UTC
On Wed, 17 Sep 2014 00:40:08 +0100 Alasdair G Kergon <agk@redhat.com> wrote:

> On Wed, Sep 17, 2014 at 12:35:29AM +0100, Alasdair G Kergon wrote:
> > > > -	ret = read_disk_sb(rdev, rdev->sb_size);
> 
> And if that needed changing to 4096, why does this similar instance elsewhere
> one not also need changing?
> 
>   static void attempt_restore_of_faulty_devices(struct raid_set *rs)
>   {
>   ...
>                     sync_page_io(r, 0, r->sb_size, r->sb_page, READ, 1)) {
> 
> Alasdair
> 

That suggests we should probably "fix" the problem in sync_page_io().

e.g.

I'll queue that up and maybe tag it for -stable.

Thanks,
NeilBrown
--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
diff mbox

Patch

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 6be7146be5b3..e02de054fd9f 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -777,6 +777,9 @@  int sync_page_io(struct md_rdev *rdev, sector_t sector, int size,
 
 	bio->bi_bdev = (metadata_op && rdev->meta_bdev) ?
 		rdev->meta_bdev : rdev->bdev;
+	size = roundup(size, bdev_logical_block_size(bio->bi_bdev));
+	if (size > PAGE_SIZE)
+		return -EINVAL;
 	if (metadata_op)
 		bio->bi_iter.bi_sector = sector + rdev->sb_start;
 	else if (rdev->mddev->reshape_position != MaxSector &&