FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Device-mapper Development

 
 
LinkBack Thread Tools
 
Old 07-25-2008, 12:52 PM
Lars Ellenberg
 
Default dm_set_device_limits: when ignoring q->merge_bvec_fn, set rs->max_phys_segments to one to avoid violating it

Restricting max_sectors is not enough.
If someone uses bio_add_page to add 8 disjunct 512 byte
partial pages to a bio, it would succeed,
but could still cross a border of whatever restrictions
are below us (raid0 stripe boundary). An attempted
bio_split would not succeed, because bi_vcnt is 8.
E.g. the xen io layer is known to do trigger this.

Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---

should maybe be "backported" to the stable series kernels as well,
at least if one plans to use xen vm's on top of lvm on top of
md or drbd.

drivers/md/dm-table.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 798e468..5995381 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -512,11 +512,22 @@ void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev)
* smaller I/O, just to be safe.
*/

- if (q->merge_bvec_fn && !ti->type->merge)
+ if (q->merge_bvec_fn && !ti->type->merge) {
rs->max_sectors =
min_not_zero(rs->max_sectors,
(unsigned int) (PAGE_SIZE >> 9));

+ /* Restricting max_sectors is not enough.
+ * If someone uses bio_add_page to add 8 disjunct 512 byte
+ * partial pages to a bio, it would succeed,
+ * but could still cross a border of whatever restrictions
+ * are below us (raid0 stripe boundary). An attempted
+ * bio_split would not succeed, because bi_vcnt is 8.
+ * E.g. the xen io layer is known to do trigger this.
+ */
+ rs->max_phys_segments = 1;
+ }
+
rs->max_phys_segments =
min_not_zero(rs->max_phys_segments,
q->max_phys_segments);
--
1.5.5.GIT

--
: Lars Ellenberg Tel +43-1-8178292-55 :
: LINBIT Information Technologies GmbH Fax +43-1-8178292-82 :
: Vivenotgasse 48, A-1120 Vienna/Europe http://www.linbit.com :

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 

Thread Tools




All times are GMT. The time now is 01:47 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org