dmraid -r -E bus error

Hall, Eric R eric.r.hall at intel.com
Mon Oct 22 16:11:11 UTC 2007


Out of curiosity, how is this patch different than the one that Jason
Gaston and Ying Fang released on 29 June 2007 other than it seems to be
more compact? ;)

http://www.redhat.com/archives/ataraid-list/2007-June/msg00037.html

- E

>-----Original Message-----
>From: ataraid-list-bounces at redhat.com [mailto:ataraid-list-
>bounces at redhat.com] On Behalf Of Ian Kent
>Sent: Monday, October 22, 2007 12:16 AM
>To: ataraid-list at redhat.com
>Subject: dmraid -r -E bus error
>
>
>Hi all,
>
>The command "dmraid -r -E <raid dev>" SEGVs if there is a single device
>in in the on disk meta data configuration.
>
>If the on disk meta data configuration contains one raid device only
>(one block only) then the isw module determines there are no extended
>attributes and extra space isn't allocated during the meta data read.
>
>However, the meta data write function fails to check whether the extra
>space is present before copying the meta data and SEGVs when trying to
>write it to the non existent memory.
>
>I consulted with Heinz Mauelshagen and we ended up with this patch.
>Comments welcome.
>
>Ian
>
>---
>diff -up 1.0.0.rc14/lib/format/ataraid/isw.c.solitary-meta-block
>1.0.0.rc14/lib/format/ataraid/isw.c
>--- 1.0.0.rc14/lib/format/ataraid/isw.c.solitary-meta-block
2006-09-23
>02:11:37.000000000 +0800
>+++ 1.0.0.rc14/lib/format/ataraid/isw.c	2007-10-22
15:10:49.000000000
>+0800
>@@ -364,21 +364,26 @@ static int isw_write(struct lib_context
> {
> 	int ret;
> 	struct isw *isw = META(rd, isw);
>+	int large = div_up(isw->mpb_size, ISW_DISK_BLOCK_SIZE) > 1;
>
> 	to_disk(isw, FULL);
>
>-	/*
>-	 * Copy 1st metadata sector to after the extended ones
>-	 * and increment metadata area pointer by one block, so
>-	 * that the metadata is filed in the proper sequence.
>-	 */
>-	memcpy((void*) isw + rd->meta_areas->size, isw,
ISW_DISK_BLOCK_SIZE);
>-	rd->meta_areas->area += ISW_DISK_BLOCK_SIZE;
>+	if (large) {
>+		/*
>+		 * Copy 1st metadata sector to after the extended ones
>+		 * and increment metadata area pointer by one block, so
>+		 * that the metadata is filed in the proper sequence.
>+		 */
>+		memcpy((void*) isw + rd->meta_areas->size, isw,
>+		       ISW_DISK_BLOCK_SIZE);
>+		rd->meta_areas->area += ISW_DISK_BLOCK_SIZE;
>+	}
>
> 	ret = write_metadata(lc, handler, rd, -1, erase);
>
> 	/* Correct metadata area pointer. */
>-	rd->meta_areas->area -= ISW_DISK_BLOCK_SIZE;
>+	if (large)
>+		rd->meta_areas->area -= ISW_DISK_BLOCK_SIZE;
>
> 	to_cpu(isw, FULL);
>
>
>
>_______________________________________________
>Ataraid-list mailing list
>Ataraid-list at redhat.com
>https://www.redhat.com/mailman/listinfo/ataraid-list




More information about the Ataraid-list mailing list