s390/dasd: Make layout analysis ESE compatible
authorJan Höppner <hoeppner@linux.ibm.com>
Thu, 21 Feb 2019 15:22:46 +0000 (16:22 +0100)
committerVasily Gorbik <gor@linux.ibm.com>
Thu, 11 Jul 2019 18:39:53 +0000 (20:39 +0200)
commitce6915f5343f5f2a2a937b683d8ffbf12dab3ad4
tree559050a5449eb56ecd780e6364f5011e0686b1f4
parent8a9f606fefadb903c323836fcd6e65a122dce66a
s390/dasd: Make layout analysis ESE compatible

The disk layout and volume information of a DASD reside in the first two
tracks of cylinder 0. When a DASD is set online, currently the first
three tracks are read and analysed to confirm an expected layout.

For CDL (Compatible Disk Layout) only count area data of the first track
is evaluated and checked against expected key and data lengths. For LDL
(Linux Disk Layout) the first and third track is evaluated. However,
an LDL formatted volume is expected to be in the same format across all
tracks. Checking the third track therefore doesn't have any more value
than checking any other track at random.

Now, an Extent Space Efficient (ESE) DASD is initialised by only
formatting the first two tracks, as those tracks always contain all
information necessarry.

Checking the third track on an ESE volume will therefore most likely
fail with a record not found error, as the third track will be empty.
This in turn leads to the device being recognised with a volume size of
0. Attempts to write volume information on the first two tracks then
fail with "no space left on device" errors.

Initialising the first three tracks for an ESE volume is not a viable
solution, because the third track is already a regular track and could
contain user data. With that there is potential for data corruption.

Instead, always only analyse the first two tracks, as it is sufficiant
for both CDL and LDL, and allow ESE volumes to be recognised as well.

Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
drivers/s390/block/dasd_eckd.c