Received: by 10.223.185.116 with SMTP id b49csp371907wrg; Sat, 10 Feb 2018 08:55:04 -0800 (PST) X-Google-Smtp-Source: AH8x226jex7rDS38POgOXjluPbFAy/TRpWcS0FDD7/UdBkwpxF2bTGSGcndgbHtbGMAcqaTu8ShX X-Received: by 10.101.76.204 with SMTP id n12mr5340337pgt.15.1518281704064; Sat, 10 Feb 2018 08:55:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518281704; cv=none; d=google.com; s=arc-20160816; b=Pkyv10qZ2ie7OQUZtMqohOe90y2Pi4ndkQ7gu/65YbBRFN1xkw8V0iLaj8Tf87Kmok zlhs+LjQQ5GZq6oRSaGbH+uq/7XDe7k0Bx7Xq3HzCzvUXXCMl/bLyKSisqiEqGgroUu+ 6pBBqP+P/MMlLKDvmLCVrSi2i7svITq6pA7mtlsU7WPv4CVMrNZst+PUJTUvIYj5Y85R hoHtu+8qxhu92Oc4J3ga7vNbIeyvWBm+GDdH6XKfqmPEMly8LcZ+uBST3q4gQrMSp7Sl UjiC7yvldqCwPL5Xbi/hjecz6rbUesJZzUy8Nn3jhoOLXuqg+EBI3miRfJ20wQxp98Aq NxpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=Haitv3EQtqmHuu+uEV1p9MJzkGfrNnNnNXSaeqji5M8=; b=EksoHQbMCZ/M6W9W38ImzKTs+E4yHMeqtJgwZiDE3KbBG9e7CQGLKo/SL19i0RZBqw ulj2Rq4StnV75WkpWgj5n1G3I9sjjeFLz17RLfdMBMocrXMZbCdg1c0r4wNioSoHLq2L pzBB1sdOJ2D82dRNccpv/tjyJw+CHXurGMnjFLRzVetXVyXR2hNXHUONL8L74JX0MuSK SAmWOcVoNQE7T08sX/gEWBdm831PqccX6Iz0GEwhDSkvTkoqysOT37BMTPZWpwmaBD0J lPLxWpcuc5b6gXWlXUZ9Di+/0R2EqB7bZ3IsJBEaNbR35maaogP7aCBiWgY4xQVo/sBw kngA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=HC3QcFHS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 35-v6si3277221pla.473.2018.02.10.08.54.50; Sat, 10 Feb 2018 08:55:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=HC3QcFHS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751055AbeBJQyK (ORCPT + 99 others); Sat, 10 Feb 2018 11:54:10 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:59722 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750857AbeBJQyJ (ORCPT ); Sat, 10 Feb 2018 11:54:09 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1AGpfBB127936; Sat, 10 Feb 2018 16:54:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=Haitv3EQtqmHuu+uEV1p9MJzkGfrNnNnNXSaeqji5M8=; b=HC3QcFHSgDTikk0ViUjtgruA2i7CrqWfQ/4j9W77omYshgi/trxXxBguV3MN/Rd1rI3V 0Sqr+aOKSi9gqiF8DqFh5S3jb7y4US/GjoMajMNDy5QAeVE0OaHe/z50AAAvOVEzGzRV HmrnhDsiQhJUYaSW9fJdkfiokuqR+WbDBDYgVaRY8OWu7WGbFM4oiqtxpk5K265fahER R9N0Z8Vw2ii1MjqHTWtNUULhEwekOl0f0LIHfsc6DXpgv7A5UH9Q2LiGxVemRBrnGI0X HgkKTdqZ8JjddM8teHQaSnTEBdaSwhDxQ52B2lWfWF9mMngIDz4xwe4+rkrKzwynZ/iy zA== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2130.oracle.com with ESMTP id 2g24fa817m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 10 Feb 2018 16:54:02 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w1AGs1Ar022064 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 10 Feb 2018 16:54:01 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w1AGs02g004946; Sat, 10 Feb 2018 16:54:00 GMT Received: from [10.39.255.229] (/10.39.255.229) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 10 Feb 2018 08:54:00 -0800 Subject: Re: [PATCH 1/2] xen: xenbus_dev_frontend: Fix XS_TRANSACTION_END handling To: Simon Gaiser , xen-devel@lists.xenproject.org Cc: stable@vger.kernel.org, Juergen Gross , linux-kernel@vger.kernel.org References: <20180207222236.7434-1-simon@invisiblethingslab.com> From: Boris Ostrovsky Message-ID: Date: Sat, 10 Feb 2018 11:53:58 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180207222236.7434-1-simon@invisiblethingslab.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8801 signatures=668668 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802100222 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/07/2018 05:22 PM, Simon Gaiser wrote: > Commit fd8aa9095a95 ("xen: optimize xenbus driver for multiple > concurrent xenstore accesses") made a subtle change to the semantic of > xenbus_dev_request_and_reply() and xenbus_transaction_end(). > > Before on an error response to XS_TRANSACTION_END > xenbus_dev_request_and_reply() would not decrement the active > transaction counter. But xenbus_transaction_end() has always counted the > transaction as finished regardless of the response. > > The new behavior is that xenbus_dev_request_and_reply() and > xenbus_transaction_end() will always count the transaction as finished > regardless the response code (handled in xs_request_exit()). > > But xenbus_dev_frontend tries to end a transaction on closing of the > device if the XS_TRANSACTION_END failed before. Trying to close the > transaction twice corrupts the reference count. So fix this by also > considering a transaction closed if we have sent XS_TRANSACTION_END once > regardless of the return code. > > Cc: # 4.11 > Fixes: fd8aa9095a95 ("xen: optimize xenbus driver for multiple concurrent xenstore accesses") > Signed-off-by: Simon Gaiser Reviewed-by: Boris Ostrovsky (although I'd prefer Juergen to also take a look at this) > --- > drivers/xen/xenbus/xenbus_dev_frontend.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c > index f3b089b7c0b6..d2edbc79384a 100644 > --- a/drivers/xen/xenbus/xenbus_dev_frontend.c > +++ b/drivers/xen/xenbus/xenbus_dev_frontend.c > @@ -365,7 +365,7 @@ void xenbus_dev_queue_reply(struct xb_req_data *req) > if (WARN_ON(rc)) > goto out; > } > - } else if (req->msg.type == XS_TRANSACTION_END) { > + } else if (req->type == XS_TRANSACTION_END) { > trans = xenbus_get_transaction(u, req->msg.tx_id); > if (WARN_ON(!trans)) > goto out; >