[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v6] libxl: allow 'phy' backend to use empty files

Roger Pau Monne writes ("[PATCH v6] libxl: allow 'phy' backend to use empty 
> This was introduced by 97ee1f (~5 years ago), but was probably never
> surfaced because most people used regular files as CDROM images, so the PHY
> backend was actually never selected. A year ago this was changed, and now
> regular RAW files are also handled by the PHY backend, which has made this
> bug surface.
> Fix it by allowing empty disks to use the PHY backend, skipping the stat
> tests.
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> Reported-by: Alex Braunegg <alex.braunegg@xxxxxxxxx>

Thanks, and thanks to Alex for the testing, but:

> diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
> index 8bb5e93..2e08108 100644
> --- a/tools/libxl/libxl_device.c
> +++ b/tools/libxl/libxl_device.c
> @@ -196,6 +196,14 @@ static int disk_try_backend(disk_try_backend_args *a,
>              goto bad_format;
>          }
> +        if (a->disk->format == LIBXL_DISK_FORMAT_EMPTY) {
> +            assert(a->disk->pdev_path == NULL ||
> +                   !strcmp(a->disk->pdev_path, ""));

I agree that these things ought to be true but I don't see what code
in libxl ensures that they definitely are.

I think this check ought to be moved to libxl__device_disk_set_backend
or perhaps even earlier, and should generate an ERROR_INVAL rather
than an assertion failure.

The rest of the logic LGTM.


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.