tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

ataraid(4) problems



Hi,

  Recently I've been trying to use firmware RAID facility supported
by my motherboard (ASUS P6T) on NetBSD/amd64.  It is recognized as
Intel MatrixRAID by ataraid(4).

  I found following three problems:

  1) accessing RAID volume causes kernel hang-up.  LOCKDEBUG kernel
     reports:
        Mutex error: lockdebug_barrier: spin lock held

  2) can't handle a volume larger than 2TiB.  gpt(8) command can't find
     GPT on those volumes.

     # gpt show ld0
     gpt: error: bogus map
     gpt: unable to open device 'rld0d': Undefined error: 0

  3) can't access to NTFS partition on a RAID0 volume.
     # mount -t ntfs /dev/ld0e /mnt
     ntfs_procfixups: magic doesn't match: c801c800 != 58444e49
     ntfs_procfixups: magic doesn't match: c801c800 != 58444e49


   Problem #1 is already known and filed as PR kern/38273, and a patch
 has already been provided by Juan RP <xtraeme@> for it.
(http://mail-index.netbsd.org/tech-kern/2008/09/17/msg002734.html)

   His patch worked for me. I think it should get into the codebase if
anyone doesn't find better solutions.

  Problem #2 is an integer overflow bug in the ataraid driver.  The
number of sectors in a RAID volume is kept in u_int which is not
big enough.

  The following patch fixed this problem:

----------------------------------------------------------------
diff -r 340991ab9d88 src/sys/dev/ata/ata_raidvar.h
--- a/src/sys/dev/ata/ata_raidvar.h     Thu May 13 02:24:14 2010 +0900
+++ b/src/sys/dev/ata/ata_raidvar.h     Thu May 13 02:42:00 2010 +0900
@@ -67,8 +67,8 @@
 struct ataraid_disk_info {
        device_t adi_dev;               /* disk's device */
        int     adi_status;             /* disk's status */
-       u_int   adi_sectors;
-       u_int   adi_compsize;           /* in sectors */
+       uint64_t        adi_sectors;
+       uint64_t        adi_compsize;           /* in sectors */
 };
 
 /* adi_status */
@@ -94,9 +94,9 @@
        u_int   aai_heads;              /* tracks/cyl */
        u_int   aai_sectors;            /* secs/track */
        u_int   aai_cylinders;          /* cyl/unit */
-       u_int   aai_capacity;           /* in sectors */
-       u_int   aai_offset;             /* component start offset */
-       u_int   aai_reserved;           /* component reserved sectors */
+       uint64_t        aai_capacity;           /* in sectors */
+       daddr_t         aai_offset;             /* component start offset */
+       uint64_t        aai_reserved;           /* component reserved sectors */
----------------------------------------------------------------


  Problem #3 is a bit weird. NTFS partition can be mounted correctly
when it is on a RAID1 volume.  I found the interleave value is handled
incorrectly on RAID0 volume by ataraid.
  The following patch fixed the problem #3:

----------------------------------------------------------------
diff -r decc052c0e82 src/sys/dev/ata/ata_raid_intel.c
--- a/src/sys/dev/ata/ata_raid_intel.c  Thu May 13 19:59:35 2010 +0900
+++ b/src/sys/dev/ata/ata_raid_intel.c  Thu May 13 20:01:27 2010 +0900
@@ -241,7 +241,7 @@
 
        aai->aai_type = ATA_RAID_TYPE_INTEL;
        aai->aai_capacity = map->total_sectors;
-       aai->aai_interleave = map->stripe_sectors / 2;
+       aai->aai_interleave = map->stripe_sectors;
        aai->aai_ndisks = map->total_disks;
        aai->aai_heads = 255;
        aai->aai_sectors = 63;
----------------------------------------------------------------

  What does this " / 2 " mean exactly?


  After fixing these 3 problems, the RAID0 volume is working good
so far.

--
bsh.



Home | Main Index | Thread Index | Old Index