Re: [Qemu-devel] [PATCH 0/2] Fix werror=enospc for qcow2 on iscsi

2015-10-22 Thread Paolo Bonzini


On 22/10/2015 10:17, Fam Zheng wrote:
> When qcow2 is created on iscsi target with a virtual size greater than 
> physical
> capacity of the LUN, over time it's possible that guest fills too much data 
> and
> at that point, new clusters in qcow2 will be allocated beyond the end of disk.
> 
> werror=enospc is useful for that purpose to allocate more data for the guest,
> except in this case, unlike a host file system, iscsi returns -EIO instead of
> -ENOSPC, which makes it hard to detect and report proper error.
> 
> Fix this by improving iscsi error handling code to return meaningful error
> codes (-ERANGE here), then further translate it to -ENOSPC in qcow2.

FWIW, Linux uses ENOSPC if it detects out of range LBAs:

if (iocb->ki_pos >= size)
return -ENOSPC;

so I think it's okay to convert LBA_OUT_OF_RANGE to ENOSPC directly and
avoid patch 2.

Paolo



Re: [Qemu-devel] [PATCH 0/2] Fix werror=enospc for qcow2 on iscsi

2015-10-22 Thread Peter Lieven

Am 22.10.2015 um 10:17 schrieb Fam Zheng:

When qcow2 is created on iscsi target with a virtual size greater than physical
capacity of the LUN, over time it's possible that guest fills too much data and
at that point, new clusters in qcow2 will be allocated beyond the end of disk.


Why would you want to put a QCOW2 on a fixed size block device?

Anyway, I like the error code translation.

Peter




[Qemu-devel] [PATCH 0/2] Fix werror=enospc for qcow2 on iscsi

2015-10-22 Thread Fam Zheng
When qcow2 is created on iscsi target with a virtual size greater than physical
capacity of the LUN, over time it's possible that guest fills too much data and
at that point, new clusters in qcow2 will be allocated beyond the end of disk.

werror=enospc is useful for that purpose to allocate more data for the guest,
except in this case, unlike a host file system, iscsi returns -EIO instead of
-ENOSPC, which makes it hard to detect and report proper error.

Fix this by improving iscsi error handling code to return meaningful error
codes (-ERANGE here), then further translate it to -ENOSPC in qcow2.

Fam


Fam Zheng (2):
  iscsi: Translate scsi sense into error code
  qcow2: Translate -ERANGE to -ENOSPC

 block/iscsi.c | 56 +++-
 block/qcow2.c |  6 ++
 2 files changed, 61 insertions(+), 1 deletion(-)

-- 
2.4.3




Re: [Qemu-devel] [PATCH 0/2] Fix werror=enospc for qcow2 on iscsi

2015-10-22 Thread Fam Zheng
On Thu, 10/22 10:32, Peter Lieven wrote:
> Am 22.10.2015 um 10:17 schrieb Fam Zheng:
> >When qcow2 is created on iscsi target with a virtual size greater than 
> >physical
> >capacity of the LUN, over time it's possible that guest fills too much data 
> >and
> >at that point, new clusters in qcow2 will be allocated beyond the end of 
> >disk.
> 
> Why would you want to put a QCOW2 on a fixed size block device?
> 

It can have a backing file.

Fam



Re: [Qemu-devel] [PATCH 0/2] Fix werror=enospc for qcow2 on iscsi

2015-10-22 Thread Kevin Wolf
Am 22.10.2015 um 10:45 hat Paolo Bonzini geschrieben:
> On 22/10/2015 10:17, Fam Zheng wrote:
> > When qcow2 is created on iscsi target with a virtual size greater than 
> > physical
> > capacity of the LUN, over time it's possible that guest fills too much data 
> > and
> > at that point, new clusters in qcow2 will be allocated beyond the end of 
> > disk.
> > 
> > werror=enospc is useful for that purpose to allocate more data for the 
> > guest,
> > except in this case, unlike a host file system, iscsi returns -EIO instead 
> > of
> > -ENOSPC, which makes it hard to detect and report proper error.
> > 
> > Fix this by improving iscsi error handling code to return meaningful error
> > codes (-ERANGE here), then further translate it to -ENOSPC in qcow2.
> 
> FWIW, Linux uses ENOSPC if it detects out of range LBAs:
> 
> if (iocb->ki_pos >= size)
> return -ENOSPC;
> 
> so I think it's okay to convert LBA_OUT_OF_RANGE to ENOSPC directly and
> avoid patch 2.

Yes, definitely. Fixing this up in qcow2 would be wrong, all other image
formats are affected as well. The iscsi block driver already needs to
return the correct errno value, which is ENOSPC.

Kevin