Commit cffab6bc5511cd6f67a60bf16b62de4267b68c4c

Authored by Peter Oberparleiter
Committed by Martin Schwidefsky
1 parent a9f7f2e74a

[S390] dasd: use correct label location for diag fba disks

Partition boundary calculation fails for DASD FBA disks under the
following conditions:
- disk is formatted with CMS FORMAT with a blocksize of more than
  512 bytes
- all of the disk is reserved to a single CMS file using CMS RESERVE
- the disk is accessed using the DIAG mode of the DASD driver

Under these circumstances, the partition detection code tries to
read the CMS label block containing partition-relevant information
from logical block offset 1, while it is in fact located at physical
block offset 1.

Fix this problem by using the correct CMS label block location
depending on the device type as determined by the DASD SENSE ID
information.

Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

Showing 1 changed file with 12 additions and 2 deletions Side-by-side Diff

... ... @@ -74,6 +74,7 @@
74 74 } *label;
75 75 unsigned char *data;
76 76 Sector sect;
  77 + sector_t labelsect;
77 78  
78 79 res = 0;
79 80 blocksize = bdev_logical_block_size(bdev);
80 81  
... ... @@ -98,10 +99,19 @@
98 99 goto out_freeall;
99 100  
100 101 /*
  102 + * Special case for FBA disks: label sector does not depend on
  103 + * blocksize.
  104 + */
  105 + if ((info->cu_type == 0x6310 && info->dev_type == 0x9336) ||
  106 + (info->cu_type == 0x3880 && info->dev_type == 0x3370))
  107 + labelsect = info->label_block;
  108 + else
  109 + labelsect = info->label_block * (blocksize >> 9);
  110 +
  111 + /*
101 112 * Get volume label, extract name and type.
102 113 */
103   - data = read_part_sector(state, info->label_block*(blocksize/512),
104   - &sect);
  114 + data = read_part_sector(state, labelsect, &sect);
105 115 if (data == NULL)
106 116 goto out_readerr;
107 117