Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp315076imm; Wed, 29 Aug 2018 00:19:41 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbn34P6jgg2TSN6pAbX1i0ZUinEh/tfauzAuKXhbDF+b7ijJ3CWIZL6xwvKs42dintx1o9g X-Received: by 2002:a63:f14d:: with SMTP id o13-v6mr4559987pgk.236.1535527181831; Wed, 29 Aug 2018 00:19:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535527181; cv=none; d=google.com; s=arc-20160816; b=R+FnoVjD8CmjjzlC07gb3+h9FUhnYSIwD9NGMUVlMO3cCuLM3ihOe2vf9gegpOM1KR M9v9xpo9dWCUASjTbeCwPRyUPhfJwZJl2p9ex3CQAK+Y7W/sb3GSKgIHJRQY3JSKzheN 0w6qroN5ym5rb7aHFnsUW3iJoidzPZS5/YdkrX+a7/c03sq7oYfMIbjWPhq9tvcyQzOM Ac37Moz7qoiW7DXpPkkG2pmcgFCFi+gIQhnKBOGvxfHuYaZrjnfTyRWM0zR60Svm6/tM D8pT8AGKhd7W6jpx0Awd3biOgyU7XL0ti78EurArXmBEnz09f9Ss2cnUOv+Jccatd0iR HEZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:message-id:date:cc:to:from :arc-authentication-results; bh=WVda49TqxylDE3jktcOEhB4EMxriah3zw5ov6iuNAn0=; b=PUtKdIgUlmEbox620PXQL3Oas+hV7YK5Zv6rl67vGkfUWohD1ObcQdGuxkJNsEVzjV KDur1mceyE/qRffBvE9+L+/FmvcX1pcGncZrABwdgBzf/MMjwzIaTF485/ouWs+7/I9Y //Uk16eYxslMMZHNSAVWmVQn7DD5JRVDve8Narz5uNot2olBnKQhQ6NzzBkawsdPtUBl S2FnrfLD06J+QkSshkYvn/gYx1VnepHNsF2l5aFDrlyMPiFaViQDp9lGlPxxuva0k07b W/cVuSPoXMYeTeUsUbpozfm8XNNreEmKudix6hz0gimHPEPxCI+YX9M7fFISjyyVxOkg ZlPA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f90-v6si3297889plf.30.2018.08.29.00.19.26; Wed, 29 Aug 2018 00:19:41 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727599AbeH2LNt (ORCPT + 99 others); Wed, 29 Aug 2018 07:13:49 -0400 Received: from mail.CARNet.hr ([161.53.123.6]:34200 "EHLO mail.carnet.hr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727054AbeH2LNt (ORCPT ); Wed, 29 Aug 2018 07:13:49 -0400 X-Greylist: delayed 1557 seconds by postgrey-1.27 at vger.kernel.org; Wed, 29 Aug 2018 07:13:47 EDT Received: from [2001:b68:ff:12::131] (port=57870 helo=gavran.carpriv.carnet.hr) by mail.carnet.hr with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fuuL1-000771-0L; Wed, 29 Aug 2018 08:52:23 +0200 Received: by gavran.carpriv.carnet.hr (Postfix, from userid 1000) id 6355820235; Wed, 29 Aug 2018 08:52:22 +0200 (CEST) From: Valentin Vidic To: =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Cc: Konrad Rzeszutek Wilk , Jens Axboe , xen-devel@lists.xenproject.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Vidic , stable@vger.kernel.org Date: Wed, 29 Aug 2018 08:52:14 +0200 Message-Id: <20180829065214.23546-1-Valentin.Vidic@CARNet.hr> X-Mailer: git-send-email 2.18.0 X-SA-Exim-Connect-IP: 2001:b68:ff:12::131 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on rigel.CARNet.hr X-Spam-Level: X-Spam-Status: No, score=-2.9 required=10.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=ham version=3.3.2 Subject: [PATCH] xen-blkback: Switch to closed state after releasing the backing device X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Switching to closed state earlier can cause the block-drbd script to fail with 'Device is held open by someone': root: /etc/xen/scripts/block-drbd: remove XENBUS_PATH=backend/vbd/6/51712 kernel: [ 2222.278235] block drbd6: State change failed: Device is held open by someone kernel: [ 2222.278304] block drbd6: state = { cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate r----- } kernel: [ 2222.278340] block drbd6: wanted = { cs:Connected ro:Secondary/Secondary ds:UpToDate/UpToDate r----- } root: /etc/xen/scripts/block-drbd: Writing backend/vbd/6/51712/hotplug-error /etc/xen/scripts/block-drbd failed; error detected. backend/vbd/6/51712/hotplug-status error to xenstore. root: /etc/xen/scripts/block-drbd: /etc/xen/scripts/block-drbd failed; error detected. Signed-off-by: Valentin Vidic Cc: stable@vger.kernel.org --- drivers/block/xen-blkback/xenbus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index a4bc74e72c39..43bddc996709 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -323,6 +323,7 @@ static void xen_blkif_free(struct xen_blkif *blkif) { WARN_ON(xen_blkif_disconnect(blkif)); xen_vbd_free(&blkif->vbd); + xenbus_switch_state(blkif->be->dev, XenbusStateClosed); kfree(blkif->be->mode); kfree(blkif->be); @@ -814,7 +815,6 @@ static void frontend_changed(struct xenbus_device *dev, case XenbusStateClosed: xen_blkif_disconnect(be->blkif); - xenbus_switch_state(dev, XenbusStateClosed); if (xenbus_dev_is_online(dev)) break; /* fall through */ -- 2.18.0