[PATCH 1/1] um: ubd: Fix data corruption

From: Richard Weinberger
Date: Tue Sep 28 2010 - 17:47:54 EST


Under high load the file system gets corrupted.
This patch fixes the issue.

Many thanks to Janjaap Bos <janjaap@xxxxxx>!

LKML-Reference: <AANLkTi=PTp7YW_eYxtF-H2QSxgei3whWH59wU0C9oCkz () mail ! gmail ! com>
Signed-off-by: Richard Weinberger <richard@xxxxxx>
---
arch/um/drivers/ubd_kern.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 1bcd208..2874b83 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -748,9 +748,12 @@ static int ubd_open_dev(struct ubd *ubd_dev)
}
ubd_dev->fd = fd;

- if(ubd_dev->cow.file != NULL){
- blk_queue_max_hw_sectors(ubd_dev->queue, 8 * sizeof(long));
+ /* A setting higher than 1 sector currently (>= v2.6.31) generates
+ data loss, both for raw and cow ubd. */
+ blk_queue_max_hw_sectors(ubd_dev->queue, 1 * sizeof(long));
+ blk_queue_max_segments(ubd_dev->queue, 1 * sizeof(long));

+ if (ubd_dev->cow.file != NULL) {
err = -ENOMEM;
ubd_dev->cow.bitmap = vmalloc(ubd_dev->cow.bitmap_len);
if(ubd_dev->cow.bitmap == NULL){
--
1.6.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/