On Tue, Dec 17, 2013 at 9:03 AM, Peter Lieven <p...@kamp.de> wrote:
> On 17.12.2013 17:47, Stefan Hajnoczi wrote:
>>
>> On Tue, Dec 17, 2013 at 10:15:25AM +0100, Peter Lieven wrote:

...
>>> +    if (nfs_pwrite_async(client->context, client->fh,
>>> +                         sector_num * BDRV_SECTOR_SIZE,
>>> +                         nb_sectors * BDRV_SECTOR_SIZE,
>>> +                         buf, nfs_co_generic_cb, &task) != 0) {
>>> +        g_free(buf);
>>> +        return -EIO;
>>
>> Can we get a more detailed errno here?  (e.g. ENOSPC)
>
> libnfs only returns 0 or -1 if the setup of the call
> fails. the status code from the RPC is more detailed
> and available in task.status.
>

The *_async() functions only allocates memory and marshalls the
arguments to the buffer.
So barring marshalling bugs, it will only fail due to OOM.

So -ENOMEM is perhaps a better error for when *_async() returns an error.
That is really the only condition where these functions will fail.


If *_async() returns success you are guaranteed that
nfs_co_generic_cb() will be invoked
and there you can inspect the status argument for more detailed reason why.

Reply via email to