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
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Libguestfs mailing list [email protected] https://www.redhat.com/mailman/listinfo/libguestfs
