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

Re: [PATCH] xen-front-pgdir-shbuf: don't record wrong grant handle upon error


  • To: Jan Beulich <jbeulich@xxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
  • From: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
  • Date: Tue, 23 Feb 2021 18:28:13 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nd2K5q7SKiHvqYeyLcJ9WLE9Sw2vdyG4fRh7sv0bBgo=; b=irBPftfn/j/RzMSb3lNuxf6mE34DzEE+U2sxMJTYJJEmK+RCQiQ3Ap514OVhQsxTm+7dbBWbTIbwwYWrL7z3UtwWOJ4SYPdq7K7CPgo+51nDxwPwKbJ67ntBJ7hAuTeFWaq0lJqQ2F+EInorfN/YeVJGXzArOmB2U1uxrO8BzT2D+E1W5n4AHQPYUN3p+w0WCqfWvOpQVBtM4kJ6l9GF3glBdjpcN66tZKSHi16Fr7j+jZtBHndOxwED487pV5dncs8RrL2/Ml7Lq5sXMdZQhjHYgWCvMjpLfa1Sq5eb6HKjb7DKaKbN+vXix7u3b5qiHwIjfDSMfe/jSu/uZymuIw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e01GgD9JiBHAfiY38eTuBe+lADk+5BHvRCLuDdyxGutesVuV3mAhTcXTK+bmk/TVKkjQ2w4kxGtXihOY7vHWrvunKSIgUdEoq/lROQ5ZbKzW6t+IhODK6oOIDlvbGy4dK74wQEgXY21o6if1C2YojvbuuJE0Rm/6ZNFQe4Gpoc6khD4ccKTAUlbkoesGZvsQO8Wx6Uz4usIVL4qSuJ+DK2KqN5ea9wycGegLbkHyMDbb1PlhpgYGHWs/7XvofvhShpY6EDQaGgSWnEBJCsS/nckcVrY2/iUjzOVP6fSgz8ebq39qtYgHiVouNQOWhFpqvQg8JsJ2HfahzSxohq4P0g==
  • Authentication-results: suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=none action=none header.from=epam.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 23 Feb 2021 18:28:25 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHXCgCim25QM03ANUywDJtpwJ6UVqpmD0iA
  • Thread-topic: [PATCH] xen-front-pgdir-shbuf: don't record wrong grant handle upon error

Hello, Jan!

On 2/23/21 6:26 PM, Jan Beulich wrote:
> In order for subsequent unmapping to not mistakenly unmap handle 0,
> record a perceived always-invalid one instead.
>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
> ---
> v2: Use INVALID_GRANT_HANDLE.
>
> --- a/drivers/xen/xen-front-pgdir-shbuf.c
> +++ b/drivers/xen/xen-front-pgdir-shbuf.c
> @@ -305,11 +305,18 @@ static int backend_map(struct xen_front_
>   
>       /* Save handles even if error, so we can unmap. */
>       for (cur_page = 0; cur_page < buf->num_pages; cur_page++) {
> -             buf->backend_map_handles[cur_page] = map_ops[cur_page].handle;
> -             if (unlikely(map_ops[cur_page].status != GNTST_okay))
> +             if (likely(map_ops[cur_page].status == GNTST_okay)) {
> +                     buf->backend_map_handles[cur_page] =
> +                             map_ops[cur_page].handle;
> +             } else {
> +                     buf->backend_map_handles[cur_page] =
> +                             INVALID_GRANT_HANDLE;
> +                     if (!ret)
> +                             ret = -ENXIO;
>                       dev_err(&buf->xb_dev->dev,
>                               "Failed to map page %d: %d\n",
>                               cur_page, map_ops[cur_page].status);
> +             }
>       }
>   
>       if (ret) {

 


Rackspace

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