From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47780) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpBUt-0005B3-2N for qemu-devel@nongnu.org; Thu, 22 Oct 2015 04:45:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZpBUs-00038p-8H for qemu-devel@nongnu.org; Thu, 22 Oct 2015 04:45:18 -0400 References: <1445501858-18790-1-git-send-email-famz@redhat.com> From: Paolo Bonzini Message-ID: <5628A212.5040607@redhat.com> Date: Thu, 22 Oct 2015 10:45:06 +0200 MIME-Version: 1.0 In-Reply-To: <1445501858-18790-1-git-send-email-famz@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 0/2] Fix werror=enospc for qcow2 on iscsi List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: Kevin Wolf , Peter Lieven , qemu-block@nongnu.org, Ronnie Sahlberg 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