Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4419d1ac7def3c2f74cab15e4a1c69cffcaadedd
Commit:     4419d1ac7def3c2f74cab15e4a1c69cffcaadedd
Parent:     aa58d61d18b89b98521364550b481fd9bd18c3b6
Author:     Olaf Hering <[EMAIL PROTECTED]>
AuthorDate: Sat Feb 10 01:45:47 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Sun Feb 11 10:51:31 2007 -0800

    [PATCH] relax check for AIX in msdos partition table
    
    The patch to identify AIX disks and ignore them has caused at least one
    machine to fail to find the root partition on 2.6.19. The patch is:
    
    http://lkml.org/lkml/2006/7/31/117
    
    The problem is some disk formatters do not blow away the first 4 bytes
    of the disk. If the disk we are installing to used to have AIX on it,
    then the first 4 bytes will still have IBMA in EBCDIC.
    
    The install in question was debian etch. Im not sure what the best fix
    is, perhaps the AIX detection code could check more than the first 4
    bytes.
    
    The whole partition info for primary partitions is in this block:
    
      dd if=/dev/sdb count=$(( 4 * 16 )) bs=1 skip=$(( 0x1be ))
    
    All other data do not matter, beside the 0x55aa marker at the end of the
    first block.
    
    Signed-off-by: Olaf Hering <[EMAIL PROTECTED]>
    Cc: OGAWA Hirofumi <[EMAIL PROTECTED]>
    Cc: Anton Blanchard <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 fs/partitions/msdos.c |   12 +++++++++++-
 include/linux/genhd.h |    2 ++
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/fs/partitions/msdos.c b/fs/partitions/msdos.c
index 8c7af17..dafd3b6 100644
--- a/fs/partitions/msdos.c
+++ b/fs/partitions/msdos.c
@@ -63,15 +63,25 @@ msdos_magic_present(unsigned char *p)
 #define AIX_LABEL_MAGIC4       0xC1
 static int aix_magic_present(unsigned char *p, struct block_device *bdev)
 {
+       struct partition *pt = (struct partition *) (p + 0x1be);
        Sector sect;
        unsigned char *d;
-       int ret = 0;
+       int slot, ret = 0;
 
        if (p[0] != AIX_LABEL_MAGIC1 &&
                p[1] != AIX_LABEL_MAGIC2 &&
                p[2] != AIX_LABEL_MAGIC3 &&
                p[3] != AIX_LABEL_MAGIC4)
                return 0;
+       /* Assume the partition table is valid if Linux partitions exists */
+       for (slot = 1; slot <= 4; slot++, pt++) {
+               if (pt->sys_ind == LINUX_SWAP_PARTITION ||
+                       pt->sys_ind == LINUX_RAID_PARTITION ||
+                       pt->sys_ind == LINUX_DATA_PARTITION ||
+                       pt->sys_ind == LINUX_LVM_PARTITION ||
+                       is_extended_partition(pt))
+                       return 0;
+       }
        d = read_dev_sector(bdev, 7, &sect);
        if (d) {
                if (d[0] == '_' && d[1] == 'L' && d[2] == 'V' && d[3] == 'M')
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 0a022b2..7a566fa 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -21,6 +21,8 @@ enum {
        WIN98_EXTENDED_PARTITION = 0x0f,
 
        LINUX_SWAP_PARTITION = 0x82,
+       LINUX_DATA_PARTITION = 0x83,
+       LINUX_LVM_PARTITION = 0x8e,
        LINUX_RAID_PARTITION = 0xfd,    /* autodetect RAID partition */
 
        SOLARIS_X86_PARTITION = LINUX_SWAP_PARTITION,
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to