[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCHv2 11/11] iscsi: assert that sectors are aligned
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCHv2 11/11] iscsi: assert that sectors are aligned to LUN blocksize |
Date: |
Mon, 1 Jul 2013 16:35:04 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Thu, Jun 27, 2013 at 03:11:35PM +0200, Peter Lieven wrote:
> if the blocksize of an iSCSI LUN is bigger than the BDRV_SECTOR_SIZE
> it is possible that sector_num or nb_sectors are not correctly
> alligned.
>
> to avoid corruption we fail requests which are misaligned.
>
> Signed-off-by: Peter Lieven <address@hidden>
> ---
> block/iscsi.c | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/block/iscsi.c b/block/iscsi.c
> index 0567b46..bff2e1f 100644
> --- a/block/iscsi.c
> +++ b/block/iscsi.c
> @@ -298,6 +298,13 @@ static int64_t sector_lun2qemu(int64_t sector, IscsiLun
> *iscsilun)
> return sector * iscsilun->block_size / BDRV_SECTOR_SIZE;
> }
>
> +static int64_t is_request_lun_aligned(int64_t sector_num, int nb_sectors,
> + IscsiLun *iscsilun)
> +{
> + return ((sector_num * BDRV_SECTOR_SIZE) % iscsilun->block_size ||
> + (nb_sectors * BDRV_SECTOR_SIZE) % iscsilun->block_size) ? 0 : 1;
> +}
When QEMU does geometry probing it reads 2KB. So if the LUN has 4KB
block size then QEMU will fail to open it? This would also affect image
formats on top of iSCSI LUNs.
AFAICT we have no way to passing I/O topology information up from the
block driver.
Stefan
- Re: [Qemu-devel] [PATCHv2 11/11] iscsi: assert that sectors are aligned to LUN blocksize,
Stefan Hajnoczi <=