[dm-devel] [PATCH] fix mirror device creation with lvcreate failed

NeilBrown neilb at suse.de
Wed Sep 17 01:15:55 UTC 2014


On Wed, 17 Sep 2014 00:40:08 +0100 Alasdair G Kergon <agk at 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.
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 &&

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

Thanks,
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/dm-devel/attachments/20140917/ca4a5d0c/attachment.sig>


More information about the dm-devel mailing list