lkml.org 
[lkml]   [2001]   [Aug]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subjectbug in raidtools: not 64 bit ready
From
Date

Hello ,


I think I encountered a problem in the raidtools. At least the mkraid
program seems to be not 64 bit ready.
I use raidtools-19990824-0.90. with Kernel 2.4.7 on an IBM zSeries (s390x).
It is a big endian 64 bit machine.
Patch is below.

How did I faced the problem?
I tried running mkraid and got the following message:

#mkraid /dev/md/0
handling MD device /dev/md/0
analyzing super-block
/dev/dasd/6353/part1: device too small (0kB)
mkraid: aborted, see the syslog and /proc/mdstat for potential clues.


How can I solve the problem?

I looked into the code of the raid-tools and found the following problem:

in md_int.h LINE 22 md_u32 is defined as unsigned int:
typedef unsigned int md_u32;

then in raid_io.c LINE 367 nr_bocks s defined ad unsigned int:

md_u32 nr_blocks;

but in raid_io.c LINE 451 and 492 a long pointer is passed. Unfortunately
long is 64 bit wide so nr_blocks will be zero and the 4 Bytes after
nr_blocks have the content nr_blocks should have:
if (ioctl(fd, BLKGETSIZE, (unsigned long)&nr_blocks) == -1) {

Therefore mkraid does not work.


Here is a simple (still ugly) patch that solves this problem on 64 bit.
Better approaches are welcome.
Meanwhile, as int and long are both 32bit on 32 bit machines this should
cause no harm.


--- raid_io.c Tue Aug 24 18:24:56 1999
+++ raid_io.c Tue Aug 14 16:16:53 2001
@@ -364,7 +364,7 @@
md_raid_info_t *array;
md_disk_info_t *disk;
struct stat stat_buf;
- md_u32 nr_blocks;
+ unsigned long nr_blocks;

if (!cfg)
return 1;

Please CC me as I am not subscribed to the list.

--
Mit freundlichen Grüßen / Best Regards

Christian Bornträger
IBM Deutschland Entwicklung GmbH
eServer SW System Evaluation + Test
email: CBORNTRA@de.ibm.com
Tel +49 7031-16-3507


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

\
 
 \ /
  Last update: 2005-03-22 12:57    [W:0.056 / U:0.532 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site