diff options
author | Olaf Hering <olh@suse.de> | 2007-02-10 04:45:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-11 13:51:31 -0500 |
commit | 4419d1ac7def3c2f74cab15e4a1c69cffcaadedd (patch) | |
tree | adeb2b715cbd53d94cf71127f4b4bd19d5544cd5 /fs | |
parent | aa58d61d18b89b98521364550b481fd9bd18c3b6 (diff) |
[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 <olh@suse.de>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: Anton Blanchard <anton@samba.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/partitions/msdos.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/partitions/msdos.c b/fs/partitions/msdos.c index 8c7af1777819..dafd3b6b2dc3 100644 --- a/fs/partitions/msdos.c +++ b/fs/partitions/msdos.c | |||
@@ -63,15 +63,25 @@ msdos_magic_present(unsigned char *p) | |||
63 | #define AIX_LABEL_MAGIC4 0xC1 | 63 | #define AIX_LABEL_MAGIC4 0xC1 |
64 | static int aix_magic_present(unsigned char *p, struct block_device *bdev) | 64 | static int aix_magic_present(unsigned char *p, struct block_device *bdev) |
65 | { | 65 | { |
66 | struct partition *pt = (struct partition *) (p + 0x1be); | ||
66 | Sector sect; | 67 | Sector sect; |
67 | unsigned char *d; | 68 | unsigned char *d; |
68 | int ret = 0; | 69 | int slot, ret = 0; |
69 | 70 | ||
70 | if (p[0] != AIX_LABEL_MAGIC1 && | 71 | if (p[0] != AIX_LABEL_MAGIC1 && |
71 | p[1] != AIX_LABEL_MAGIC2 && | 72 | p[1] != AIX_LABEL_MAGIC2 && |
72 | p[2] != AIX_LABEL_MAGIC3 && | 73 | p[2] != AIX_LABEL_MAGIC3 && |
73 | p[3] != AIX_LABEL_MAGIC4) | 74 | p[3] != AIX_LABEL_MAGIC4) |
74 | return 0; | 75 | return 0; |
76 | /* Assume the partition table is valid if Linux partitions exists */ | ||
77 | for (slot = 1; slot <= 4; slot++, pt++) { | ||
78 | if (pt->sys_ind == LINUX_SWAP_PARTITION || | ||
79 | pt->sys_ind == LINUX_RAID_PARTITION || | ||
80 | pt->sys_ind == LINUX_DATA_PARTITION || | ||
81 | pt->sys_ind == LINUX_LVM_PARTITION || | ||
82 | is_extended_partition(pt)) | ||
83 | return 0; | ||
84 | } | ||
75 | d = read_dev_sector(bdev, 7, §); | 85 | d = read_dev_sector(bdev, 7, §); |
76 | if (d) { | 86 | if (d) { |
77 | if (d[0] == '_' && d[1] == 'L' && d[2] == 'V' && d[3] == 'M') | 87 | if (d[0] == '_' && d[1] == 'L' && d[2] == 'V' && d[3] == 'M') |