[Libguestfs] [PATCH nbdkit 0/4] Reflection plugin, peer name.

Eric Blake eblake at redhat.com
Mon Sep 16 15:49:11 UTC 2019


On 9/15/19 10:04 AM, Richard W.M. Jones wrote:
> On Sun, Sep 15, 2019 at 03:55:41PM +0100, Richard W.M. Jones wrote:
>>  - Plugins could change content based on client.  (The fourth patch in
>>    the series is a PoC of this implemented in the new reflection
>>    plugin.)  Be cautious about combining this feature with multi-conn
>>    as it's not obviously always safe to do.
> 
> Given this commit, I guess we should squash in the following to the
> 4th patch:
> 
> diff --git a/plugins/reflection/reflection.c b/plugins/reflection/reflection.c
> index a0d7c60..f765557 100644
> --- a/plugins/reflection/reflection.c
> +++ b/plugins/reflection/reflection.c
> @@ -303,11 +303,22 @@ reflection_get_size (void *handle)
>    return (int64_t) h->len;
>  }
>  
> -/* Read-only plugin so multi-conn is safe. */
>  static int
>  reflection_can_multi_conn (void *handle)
>  {
> -  return 1;
> +  switch (mode) {
> +    /* Safe for exportname modes since clients should only request
> +     * multi-conn with the same export name.
> +     */
> +  case MODE_EXPORTNAME:
> +  case MODE_BASE64EXPORTNAME:
> +    return 1;
> +    /* Unsafe for mode=address because all multi-conn connections
> +     * won't necessarily originate from the same client address.
> +     */
> +  case MODE_ADDRESS:
> +    return 0;

Correct - any two simultaneous clients over TCP will necessarily have
different content even if they have requested the same export name, so
you do need this patch squashed in.  Unix sockets (currently) get the
same content, but it's not worth trying to distinguish TCP vs. Unix
sockets here.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20190916/c281ff12/attachment.sig>


More information about the Libguestfs mailing list