diff options
author | Stefan Haberland <sth@linux.vnet.ibm.com> | 2016-12-19 17:15:50 +0100 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2016-12-19 09:20:59 -0700 |
commit | 633395b67bb222f85bb8f825c7751a54b9ec84ee (patch) | |
tree | 871ee04fe6944d654043760bc36e02c453620e63 /drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |
parent | c965809c669da004b660e5923b8add8fac5a7dc8 (diff) |
block: check partition alignment
Partitions that are not aligned to the blocksize of a device may cause
invalid I/O requests because the blocklayer cares only about alignment
within the partition when building requests on partitions.
device
|--------4096--------|--------4096--------|--------4096--------|
partition offset 512byte
|-512-|--------4096--------|--------4096--------|--------4096--------|
When reading/writing one 4k block of the partition this maps to
reading/writing with an offset of 512 byte of the device leading to
unaligned requests for the device which in turn may cause unexpected
behavior of the device driver.
For DASD devices we have to translate the block number into a cylinder,
head, record format. The unaligned requests lead to wrong calculation
and therefore to misdirected I/O. In a "good" case this leads to I/O
errors because the underlying hardware detects the wrong addressing.
In a worst case scenario this might destroy data on the device.
To prevent partitions that are not aligned to the physical blocksize
of a device check for the alignment in the blkpg_ioctl.
Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/net/ethernet/stmicro/stmmac/stmmac_main.c')
0 files changed, 0 insertions, 0 deletions