Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1614375imm; Fri, 7 Sep 2018 03:22:20 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZlTNRrGLIe6Jmi8f6bSbA5O03jjJ+5NZPGcdBkEYw7ytUTNDFqQ9NLByMFI9DBDSizx8HA X-Received: by 2002:a17:902:e00b:: with SMTP id ca11-v6mr7127530plb.224.1536315740666; Fri, 07 Sep 2018 03:22:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536315740; cv=none; d=google.com; s=arc-20160816; b=eXBHYQXeujOzoNPNAt1oj+/inKR8LFfLKVqug2kyaEyIxG3pCUOAzeSb9qHrX/UGYc IUb38Z7YJedHcgLJ5A3ZuGTLuUA4ald4qiK4gcBsEfgjvofOveWniawhevDrl95rJlYk XtDT6qN0awNpPAbJ75iv01uF9Rp6Slv/juT7vYzJUpDUH7DJ1ftE5YMPFzRdV5W7aA+d kb1RVk2TsTdXh21QgEg1f3mkMdJuQ+Za7qaZZx5/3KrxUyvje5sfovHNe9QLhgGw3qQY 6doGtVvWPlzolZ2lxOVGTmzbQiBnutBOEK2FmIkmScQX2sekmD2qJdV/jgQoyi7NzF75 JvwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:cc:to:from:date; bh=gNKNfo7bZSdJHijKf0SwGsADdoUnNyAEj3P6jTrVaoI=; b=sr3pLPVZVzFYSjd5qjtWTgwv4NnYmSeTZ8kkbbPjK59dyswWJIP9FAy/TSRZ/iMnSH 2lYdyE90uftLDADSztwTofziQYaYGTFPugxXaWAOm0HbT4SctnJG26a82unpQ/OK1r97 zakvxtNMnmXqc/fDxC4RNh9tLIMRC/tx9Vwivn7zrJ+dkMR6lozVBLh0vm1s0Gkk6NtS YE94XQlqUHngKdOxZjVXdT2oNONS8dym9Q9hMDODfR4OKB+7gb5L7wVb2++vgg9c0YGV Zb3jhXJN1+woJhux9lMn1h8Iwt9WC+PXpEt/23f6xU/sXo65FM4hqaRNiMWgfkQm7VMc 8kdA== 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 n7-v6si7584650plk.204.2018.09.07.03.22.04; Fri, 07 Sep 2018 03:22:20 -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 S1728353AbeIGPAv (ORCPT + 99 others); Fri, 7 Sep 2018 11:00:51 -0400 Received: from mail.CARNet.hr ([161.53.123.6]:46557 "EHLO mail.carnet.hr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726295AbeIGPAv (ORCPT ); Fri, 7 Sep 2018 11:00:51 -0400 Received: from cnzgrivvl-t440p.carpriv.carnet.hr ([161.53.12.131]:59632 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 1fyDsI-0002wZ-Nu; Fri, 07 Sep 2018 12:20:27 +0200 Received: by gavran.carpriv.carnet.hr (Postfix, from userid 1000) id 89AAE202E0; Fri, 7 Sep 2018 12:20:26 +0200 (CEST) Date: Fri, 7 Sep 2018 12:20:26 +0200 From: Valentin Vidic To: Roger Pau =?iso-8859-1?Q?Monn=E9?= Cc: Konrad Rzeszutek Wilk , Jens Axboe , xen-devel@lists.xenproject.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, drbd-user@lists.linbit.com Message-ID: <20180907102026.GH26705@gavran.carpriv.carnet.hr> References: <20180829065214.23546-1-Valentin.Vidic@CARNet.hr> <20180905103649.edugijsjx4v2fbxd@mac.bytemobile.com> <20180905113515.GU26705@gavran.carpriv.carnet.hr> <20180905162801.GB26705@gavran.carpriv.carnet.hr> <20180906162932.7qge5dmrgyqbmbbj@mac.bytemobile.com> <20180906221929.GZ26705@gavran.carpriv.carnet.hr> <20180907071530.te5dxdvg4zqgqscj@mac.bytemobile.com> <20180907072319.GA26705@gavran.carpriv.carnet.hr> <20180907075455.szxahgevvlmfjvwy@mac.bytemobile.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180907075455.szxahgevvlmfjvwy@mac.bytemobile.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 161.53.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 autolearn=ham version=3.3.2 Subject: Re: [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 On Fri, Sep 07, 2018 at 09:54:55AM +0200, Roger Pau Monn? wrote: > Then I'm afraid you will have to look into the vbd_free/create fix. Yes, here is a first draft for that idea, let me know if you see some problems there: --- xenbus.c.orig 2018-09-07 12:11:57.798071485 +0200 +++ xenbus.c 2018-09-07 12:14:23.536077992 +0200 @@ -758,6 +759,7 @@ enum xenbus_state frontend_state) { struct backend_info *be = dev_get_drvdata(&dev->dev); + struct block_device *bdev; int err; pr_debug("%s %p %s\n", __func__, dev, xenbus_strstate(frontend_state)); @@ -772,6 +774,22 @@ case XenbusStateInitialised: case XenbusStateConnected: + if (!be->blkif->vbd.bdev) { + printk("blkdev_get"); + bdev = blkdev_get_by_dev(be->blkif->vbd.pdevice, + be->blkif->vbd.readonly ? + FMODE_READ : FMODE_WRITE, NULL); + + if (IS_ERR(bdev)) { + pr_warn("frontend_changed: device %08x could not be opened\n", + be->blkif->vbd.pdevice); + break; + } + + printk("blkdev_get good"); + be->blkif->vbd.bdev = bdev; + } + /* * Ensure we connect even when two watches fire in * close succession and we miss the intermediate value @@ -808,6 +826,7 @@ case XenbusStateClosed: xen_blkif_disconnect(be->blkif); + xen_vbd_free(&be->blkif->vbd); xenbus_switch_state(dev, XenbusStateClosed); if (xenbus_dev_is_online(dev)) break; -- Valentin