All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/1] block: fix return code for partial write for Linux AIO
@ 2016-06-23 11:37 Denis V. Lunev
  2016-06-28 11:21 ` Denis V. Lunev
  2016-06-28 11:52 ` Kevin Wolf
  0 siblings, 2 replies; 5+ messages in thread
From: Denis V. Lunev @ 2016-06-23 11:37 UTC (permalink / raw)
  To: qemu-block, qemu-devel; +Cc: den, Pavel Borzenkov, Kevin Wolf, Max Reitz

Partial write most likely means that there is not space rather than
"something wrong happens". Thus it would be more natural to return
ENOSPC rather than EINVAL.

The problem actually happens with NBD server, which has reported EINVAL
rather then ENOSPC on the first error using its protocol, which makes
report to the user wrong.

Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Pavel Borzenkov <pborzenkov@virtuozzo.com>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Max Reitz <mreitz@redhat.com>
---
 block/linux-aio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/linux-aio.c b/block/linux-aio.c
index e468960..7df8651 100644
--- a/block/linux-aio.c
+++ b/block/linux-aio.c
@@ -87,7 +87,7 @@ static void qemu_laio_process_completion(struct qemu_laiocb *laiocb)
                 qemu_iovec_memset(laiocb->qiov, ret, 0,
                     laiocb->qiov->size - ret);
             } else {
-                ret = -EINVAL;
+                ret = -ENOSPC;
             }
         }
     }
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] block: fix return code for partial write for Linux AIO
  2016-06-23 11:37 [Qemu-devel] [PATCH 1/1] block: fix return code for partial write for Linux AIO Denis V. Lunev
@ 2016-06-28 11:21 ` Denis V. Lunev
  2016-06-28 14:22   ` Eric Blake
  2016-06-28 11:52 ` Kevin Wolf
  1 sibling, 1 reply; 5+ messages in thread
From: Denis V. Lunev @ 2016-06-28 11:21 UTC (permalink / raw)
  To: qemu-block, qemu-devel; +Cc: Pavel Borzenkov, Kevin Wolf, Max Reitz

On 06/23/2016 02:37 PM, Denis V. Lunev wrote:
> Partial write most likely means that there is not space rather than
> "something wrong happens". Thus it would be more natural to return
> ENOSPC rather than EINVAL.
>
> The problem actually happens with NBD server, which has reported EINVAL
> rather then ENOSPC on the first error using its protocol, which makes
> report to the user wrong.
>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Pavel Borzenkov <pborzenkov@virtuozzo.com>
> CC: Kevin Wolf <kwolf@redhat.com>
> CC: Max Reitz <mreitz@redhat.com>
> ---
>   block/linux-aio.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/linux-aio.c b/block/linux-aio.c
> index e468960..7df8651 100644
> --- a/block/linux-aio.c
> +++ b/block/linux-aio.c
> @@ -87,7 +87,7 @@ static void qemu_laio_process_completion(struct qemu_laiocb *laiocb)
>                   qemu_iovec_memset(laiocb->qiov, ret, 0,
>                       laiocb->qiov->size - ret);
>               } else {
> -                ret = -EINVAL;
> +                ret = -ENOSPC;
>               }
>           }
>       }
ping

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] block: fix return code for partial write for Linux AIO
  2016-06-23 11:37 [Qemu-devel] [PATCH 1/1] block: fix return code for partial write for Linux AIO Denis V. Lunev
  2016-06-28 11:21 ` Denis V. Lunev
@ 2016-06-28 11:52 ` Kevin Wolf
  1 sibling, 0 replies; 5+ messages in thread
From: Kevin Wolf @ 2016-06-28 11:52 UTC (permalink / raw)
  To: Denis V. Lunev; +Cc: qemu-block, qemu-devel, Pavel Borzenkov, Max Reitz

Am 23.06.2016 um 13:37 hat Denis V. Lunev geschrieben:
> Partial write most likely means that there is not space rather than
> "something wrong happens". Thus it would be more natural to return
> ENOSPC rather than EINVAL.
> 
> The problem actually happens with NBD server, which has reported EINVAL
> rather then ENOSPC on the first error using its protocol, which makes
> report to the user wrong.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Pavel Borzenkov <pborzenkov@virtuozzo.com>
> CC: Kevin Wolf <kwolf@redhat.com>
> CC: Max Reitz <mreitz@redhat.com>

Thanks, applied to the block branch.

Kevin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] block: fix return code for partial write for Linux AIO
  2016-06-28 11:21 ` Denis V. Lunev
@ 2016-06-28 14:22   ` Eric Blake
  2016-06-28 14:37     ` Denis V. Lunev
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Blake @ 2016-06-28 14:22 UTC (permalink / raw)
  To: Denis V. Lunev, qemu-block, qemu-devel
  Cc: Kevin Wolf, Pavel Borzenkov, Max Reitz

[-- Attachment #1: Type: text/plain, Size: 826 bytes --]

On 06/28/2016 05:21 AM, Denis V. Lunev wrote:
> On 06/23/2016 02:37 PM, Denis V. Lunev wrote:
>> Partial write most likely means that there is not space rather than
>> "something wrong happens". Thus it would be more natural to return
>> ENOSPC rather than EINVAL.
>>
>> The problem actually happens with NBD server, which has reported EINVAL
>> rather then ENOSPC on the first error using its protocol, which makes
>> report to the user wrong.

I'm not stating that this patch is wrong, but I'm also wondering if NBD
code needs to be patched (the NBD protocol specifically recommends
ENOSPC rather than EINVAL on attempts to write larger than size).  In
fact, commit 29b6c3b3 may have been that fix.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] block: fix return code for partial write for Linux AIO
  2016-06-28 14:22   ` Eric Blake
@ 2016-06-28 14:37     ` Denis V. Lunev
  0 siblings, 0 replies; 5+ messages in thread
From: Denis V. Lunev @ 2016-06-28 14:37 UTC (permalink / raw)
  To: Eric Blake, qemu-block, qemu-devel; +Cc: Kevin Wolf, Pavel Borzenkov, Max Reitz

On 06/28/2016 05:22 PM, Eric Blake wrote:
> On 06/28/2016 05:21 AM, Denis V. Lunev wrote:
>> On 06/23/2016 02:37 PM, Denis V. Lunev wrote:
>>> Partial write most likely means that there is not space rather than
>>> "something wrong happens". Thus it would be more natural to return
>>> ENOSPC rather than EINVAL.
>>>
>>> The problem actually happens with NBD server, which has reported EINVAL
>>> rather then ENOSPC on the first error using its protocol, which makes
>>> report to the user wrong.
> I'm not stating that this patch is wrong, but I'm also wondering if NBD
> code needs to be patched (the NBD protocol specifically recommends
> ENOSPC rather than EINVAL on attempts to write larger than size).  In
> fact, commit 29b6c3b3 may have been that fix.
>
this patch does not patch return code in NBD layer
directly. Here the command comes normally to QCOW2
and then below to raw-posix/linux-aio.

 From the point of low level there is no error at all,
the write has partial success status. In this case
completion handler raises EINVAL and this code
is reported to the caller, i.e. to NBD and through
NBD to the client.

In terms of NBD the patch altered return code
from blk_pwrite in nbd_trip(). The same code will
be reported to all other users and thus VM will be
properly put to pause if configured on the first
failed request without reporting the error to guest.

NBD is just an example.

Den

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-06-28 14:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-23 11:37 [Qemu-devel] [PATCH 1/1] block: fix return code for partial write for Linux AIO Denis V. Lunev
2016-06-28 11:21 ` Denis V. Lunev
2016-06-28 14:22   ` Eric Blake
2016-06-28 14:37     ` Denis V. Lunev
2016-06-28 11:52 ` Kevin Wolf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.