public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Adriana Kobylak <anoo@linux.ibm.com>
To: medadyoung@gmail.com, joel@jms.id.au, jk@ozlabs.org
Cc: jbacik@fb.com, axboe@kernel.dk, linux-block@vger.kernel.org,
	openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	nbd@other.debian.org,
	openbmc <openbmc-bounces+anoo=linux.ibm.com@lists.ozlabs.org>
Subject: Re: [PATCH] nbd:clear NBD_BOUND flag when NBD connection is closed
Date: Thu, 13 Dec 2018 08:21:49 -0600	[thread overview]
Message-ID: <a1da3fff285fe13d04522f1a6e72bdc1@linux.vnet.ibm.com> (raw)
In-Reply-To: <1544509023-18923-1-git-send-email-medadyoung@gmail.com>

On 2018-12-11 00:17, medadyoung@gmail.com wrote:
> From: Medad <medadyoung@gmail.com>
> 
>     If we do NOT clear NBD_BOUND flag when NBD connection is closed,
>     then the original NBD device could not be used again.
> 
> Signed-off-by: Medad <medadyoung@gmail.com>

Tested on Witherspoon (OpenPOWER P9 with AST2500) and verified with
this patch that the NBD device could be disconnected/reconnected.

Tested by: Adriana Kobylak <anoo@linux.ibm.com>

> ---
>  drivers/block/nbd.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> index 64278f4..5c88490 100644
> --- a/drivers/block/nbd.c
> +++ b/drivers/block/nbd.c
> @@ -277,10 +277,14 @@ static void sock_shutdown(struct nbd_device *nbd)
>  	struct nbd_config *config = nbd->config;
>  	int i;
> 
> -	if (config->num_connections == 0)
> +	if (config->num_connections == 0) {
> +		clear_bit(NBD_BOUND, &config->runtime_flags);
>  		return;
> -	if (test_and_set_bit(NBD_DISCONNECTED, &config->runtime_flags))
> +	}
> +	if (test_and_set_bit(NBD_DISCONNECTED, &config->runtime_flags)) {
> +		clear_bit(NBD_BOUND, &config->runtime_flags);
>  		return;
> +	}
> 
>  	for (i = 0; i < config->num_connections; i++) {
>  		struct nbd_sock *nsock = config->socks[i];
> @@ -944,7 +948,7 @@ static int nbd_reconnect_socket(struct nbd_device
> *nbd, unsigned long arg)
>  		sockfd_put(old);
> 
>  		clear_bit(NBD_DISCONNECTED, &config->runtime_flags);
> -
> +		clear_bit(NBD_BOUND, &config->runtime_flags);
>  		/* We take the tx_mutex in an error path in the recv_work, so we
>  		 * need to queue_work outside of the tx_mutex.
>  		 */
> @@ -1020,6 +1024,7 @@ static int nbd_disconnect(struct nbd_device *nbd)
>  	dev_info(disk_to_dev(nbd->disk), "NBD_DISCONNECT\n");
>  	set_bit(NBD_DISCONNECT_REQUESTED, &config->runtime_flags);
>  	send_disconnects(nbd);
> +	clear_bit(NBD_BOUND, &config->runtime_flags);
>  	return 0;
>  }


      reply	other threads:[~2018-12-13 14:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-11  6:17 [PATCH] nbd:clear NBD_BOUND flag when NBD connection is closed medadyoung
2018-12-13 14:21 ` Adriana Kobylak [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a1da3fff285fe13d04522f1a6e72bdc1@linux.vnet.ibm.com \
    --to=anoo@linux.ibm.com \
    --cc=axboe@kernel.dk \
    --cc=jbacik@fb.com \
    --cc=jk@ozlabs.org \
    --cc=joel@jms.id.au \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=medadyoung@gmail.com \
    --cc=nbd@other.debian.org \
    --cc=openbmc-bounces+anoo=linux.ibm.com@lists.ozlabs.org \
    --cc=openbmc@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox