Is anyone planning to pick this up and turn it into a formal
patch for  QEMU ?  We're hitting this breakage again in Fedora
with libnfs6 and its also hit homebrew and probably other
distros too.

On Sun, Dec 15, 2024 at 12:52:47PM +1000, ronnie sahlberg wrote:
> Maybe something like this:
> ---
> diff --git a/block/nfs.c b/block/nfs.c
> index 0500f60c08..f768ee0c4b 100644
> --- a/block/nfs.c
> +++ b/block/nfs.c
> @@ -268,11 +268,18 @@ static int coroutine_fn
> nfs_co_preadv(BlockDriverState *bs, int64_t offset,
>      NFSRPC task;
> 
>      nfs_co_init_task(bs, &task);
> -    task.iov = iov;
> 
>      WITH_QEMU_LOCK_GUARD(&client->mutex) {
> +#ifdef LIBNFS_API_V2
> +        if (nfs_pread_async(client->context, client->fh,
> +                            iov->iov[0].iov_base,
> +                            bytes > iov->iov[0].iov_len ?
> iov->iov[0].iov_len : bytes,
> +                            offset, nfs_co_generic_cb, &task) != 0) {
> +#else
> +        task.iov = iov;
>          if (nfs_pread_async(client->context, client->fh,
>                              offset, bytes, nfs_co_generic_cb, &task) != 0) {
> +#endif
>              return -ENOMEM;
>          }
> 
> @@ -317,9 +324,15 @@ static int coroutine_fn
> nfs_co_pwritev(BlockDriverState *bs, int64_t offset,
>      }
> 
>      WITH_QEMU_LOCK_GUARD(&client->mutex) {
> +#ifdef LIBNFS_API_V2
> +        if (nfs_pwrite_async(client->context, client->fh,
> +                             buf, bytes, offset,
> +                             nfs_co_generic_cb, &task) != 0) {
> +#else
>          if (nfs_pwrite_async(client->context, client->fh,
>                               offset, bytes, buf,
>                               nfs_co_generic_cb, &task) != 0) {
> +#endif
>              if (my_buffer) {
>                  g_free(buf);
>              }
> ---

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


Reply via email to