Re: [RFC] block: check partition alignment

2016-12-19 Thread Stefan Haberland
Am 14.12.2016 um 18:07 schrieb Christoph Hellwig: >> To prevent partitions that are not aligned to the physical blocksize >> > of a device check for the alignment in the blkpg_ioctl. > We'd also need to reject this when reading partitions from disk, right? > I am not sure if there is a problem. I

Re: [RFC] block: check partition alignment

2016-12-15 Thread Christoph Hellwig
On Thu, Dec 15, 2016 at 10:33:47AM +0900, Damien Le Moal wrote: > For a regular block device, I agree. But in Stephan case, I think that > the check really needs to be against the physical block size, with the > added condition that the bdev is a DASD device (similarly to the zone > alignment check

Re: [RFC] block: check partition alignment

2016-12-15 Thread Damien Le Moal
On 12/15/16 17:45, Christoph Hellwig wrote: > On Thu, Dec 15, 2016 at 10:33:47AM +0900, Damien Le Moal wrote: >> For a regular block device, I agree. But in Stephan case, I think that >> the check really needs to be against the physical block size, with the >> added condition that the bdev is a D

Re: [RFC] block: check partition alignment

2016-12-14 Thread Damien Le Moal
Christoph, On 12/15/16 02:07, Christoph Hellwig wrote: >> To prevent partitions that are not aligned to the physical blocksize >> of a device check for the alignment in the blkpg_ioctl. > > We'd also need to reject this when reading partitions from disk, right? Only for DASD devices, no ? Logi

Re: [RFC] block: check partition alignment

2016-12-14 Thread Damien Le Moal
> sd.c ensures that the logical block size (sector size in sd.c) is a > power of 2 between 512 and 4096. So you can use: > > if (p.start & (bdev_physical_block_size(bdev) - 1)) Sorry, that was a little too short as a complete proof: sd.c ensures that the logical block size (sector size in sd.c)

Re: [RFC] block: check partition alignment

2016-12-14 Thread Damien Le Moal
Stefan, On 12/15/16 01:47, Stefan Haberland wrote: > 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|

Re: [RFC] block: check partition alignment

2016-12-14 Thread Christoph Hellwig
> To prevent partitions that are not aligned to the physical blocksize > of a device check for the alignment in the blkpg_ioctl. We'd also need to reject this when reading partitions from disk, right? > + /* check if partition is aligned to blocksize */ > +

[RFC] block: check partition alignment

2016-12-14 Thread Stefan Haberland
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