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

Re: [PATCH 2/6] Reset StorNvme's StartOverride



This could be taken now (XenServer carries a patch to do this already)
It only seems to be an issue with particular emulated storage devices, so may not be required based on the emulated configuration of the VM.

Owen

On Tue, Sep 12, 2023 at 8:18 AM Paul Durrant <xadimgnik@xxxxxxxxx> wrote:
[CAUTION - EXTERNAL EMAIL] DO NOT reply, click links, or open attachments unless you have verified the sender and know the content is safe.

On 31/08/2023 08:29, Owen Smith wrote:
> When StorNvme does not enumerate any devices during boot start, it sets
> the StartOverride value, which means that StorNvme does not start during
> the next boot.
> This can be an issue when attempting to revert to emulated boot, such as
> during a driver upgrade, as StorNvme will not be loaded and not take control
> of the boot disk, leading to a 0x7B bugcheck.
>
> Signed-off-by: Owen Smith <owen.smith@xxxxxxxxx>
> ---
>   src/monitor/monitor.c | 63 +++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 63 insertions(+)
>

This seems like a straight fix for an existing problem so I could take
it now?

Reviewed-by: Paul Durrant <paul@xxxxxxx>

> diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
> index bb872ce..185838f 100644
> --- a/src/monitor/monitor.c
> +++ b/src/monitor/monitor.c
> @@ -1173,6 +1173,66 @@ fail1:
>       return FALSE;
>   }
>   
> +static BOOL
> +RemoveStartOverride(
> +    IN PTCHAR           DriverName
> +    )
> +{
> +    TCHAR               KeyName[MAX_PATH];
> +    HKEY                Key;
> +    DWORD               Value;
> +    HRESULT             Error;
> +
> +    Error = StringCbPrintf(KeyName,
> +                           MAX_PATH,
> +                           SERVICES_KEY "\\%s\\StartOverride",
> +                           DriverName);
> +    assert(SUCCEEDED(Error));
> +
> +    Error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
> +                         KeyName,
> +                         0,
> +                         KEY_READ | KEY_WRITE,
> +                         &Key);
> +    if (Error != ERROR_SUCCESS) {
> +        SetLastError(Error);
> +        goto fail1;
> +    }
> +
> +    Value = 0;
> +    Error = RegSetValueEx(Key,
> +                          "0",
> +                          0,
> +                          REG_DWORD,
> +                          (const BYTE*)&Value,
> +                          (DWORD) sizeof(Value));
> +    if (Error != ERROR_SUCCESS) {
> +        SetLastError(Error);
> +        goto fail2;
> +    }
> +
> +    RegCloseKey(Key);
> +
> +    return TRUE;
> +
> +fail2:
> +    Log("fail2");
> +
> +    RegCloseKey(Key);
> +
> +fail1:
> +    Error = GetLastError();
> +
> +    {
> +        PTCHAR  Message;
> +        Message = GetErrorMessage(Error);
> +        Log("fail1 (%s)", Message);
> +        LocalFree(Message);
> +    }
> +
> +    return FALSE;
> +}
> +
>   VOID WINAPI
>   MonitorMain(
>       _In_    DWORD       argc,
> @@ -1189,6 +1249,8 @@ MonitorMain(
>   
>       Log("====>");
>   
> +    (VOID) RemoveStartOverride("stornvme");
> +
>       Error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
>                            PARAMETERS_KEY(__MODULE__),
>                            0,
> @@ -1301,6 +1363,7 @@ done:
>       (VOID) DeregisterEventSource(Context->EventLog);
>   
>       CloseHandle(Context->ParametersKey);
> +    (VOID) RemoveStartOverride("stornvme");
>   
>       Log("<====");
>   



 


Rackspace

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