All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dm raid: ensure metadata IO matches device block size.
@ 2014-10-15  1:19 NeilBrown
  2014-10-15  2:55 ` Mike Snitzer
  0 siblings, 1 reply; 7+ messages in thread
From: NeilBrown @ 2014-10-15  1:19 UTC (permalink / raw)
  To: Mike Snitzer
  Cc: Liuhua Wang, Heinz Mauelshagen, device-mapper development,
	Alasdair G Kergon


[-- Attachment #1.1: Type: text/plain, Size: 1085 bytes --]


dm_raid_superblock is 512.
Reading or writing this on a 512-byte sector works fine.
On a 4096-byte sector device, this fails.

If we round up rdev->sb_size to match the block size of
the device, all IO will work correctly.

Reported-by: "Liuhua Wang" <lwang@suse.com>
Signed-off-by: NeilBrown <neilb@suse.de>

---
this issue has been discussed already a bit. See email thread
 Subject: Re: [dm-devel] [PATCH] fix mirror device creation with lvcreate failed
I think this is the best fix.  It handles boths read and writes, and (I think)
at the best level.

Thanks,
NeilBrown


diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 4880b69e2e9e..31bdd73bc368 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -858,7 +858,8 @@ static int super_load(struct md_rdev *rdev, struct md_rdev *refdev)
 	uint64_t events_sb, events_refsb;
 
 	rdev->sb_start = 0;
-	rdev->sb_size = sizeof(*sb);
+	rdev->sb_size = roundup(sizeof(*sb),
+				bdev_logical_block_size(rdev->meta_bdev));
 
 	ret = read_disk_sb(rdev, rdev->sb_size);
 	if (ret)

[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-10-16 19:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-15  1:19 [PATCH] dm raid: ensure metadata IO matches device block size NeilBrown
2014-10-15  2:55 ` Mike Snitzer
2014-10-15  3:40   ` NeilBrown
2014-10-15 13:13     ` Mike Snitzer
2014-10-15 21:00       ` NeilBrown
2014-10-16 13:31         ` Heinz Mauelshagen
2014-10-16 19:56           ` Mike Snitzer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.