Skip to content

Commit

Permalink
[S390] dasd: use correct label location for diag fba disks
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
oberpar authored and Martin Schwidefsky committed Jul 19, 2010
1 parent a9f7f2e commit cffab6b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions fs/partitions/ibm.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ int ibm_partition(struct parsed_partitions *state)
} *label;
unsigned char *data;
Sector sect;
sector_t labelsect;

res = 0;
blocksize = bdev_logical_block_size(bdev);
Expand All @@ -97,11 +98,20 @@ int ibm_partition(struct parsed_partitions *state)
ioctl_by_bdev(bdev, HDIO_GETGEO, (unsigned long)geo) != 0)
goto out_freeall;

/*
* Special case for FBA disks: label sector does not depend on
* blocksize.
*/
if ((info->cu_type == 0x6310 && info->dev_type == 0x9336) ||
(info->cu_type == 0x3880 && info->dev_type == 0x3370))
labelsect = info->label_block;
else
labelsect = info->label_block * (blocksize >> 9);

/*
* Get volume label, extract name and type.
*/
data = read_part_sector(state, info->label_block*(blocksize/512),
&sect);
data = read_part_sector(state, labelsect, &sect);
if (data == NULL)
goto out_readerr;

Expand Down

0 comments on commit cffab6b

Please sign in to comment.