linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: "Markus Blöchl" <Markus.Bloechl@ipetronik.com>
Cc: Christoph Hellwig <hch@lst.de>,
	axboe@kernel.dk, kbusch@kernel.org,
	linux-nvme@lists.infradead.org, linux-block@vger.kernel.org
Subject: Re: [PATCH 1/2] block: fix surprise removal for drivers calling blk_set_queue_dying
Date: Wed, 16 Feb 2022 18:09:19 +0100	[thread overview]
Message-ID: <20220216170919.GA20782@lst.de> (raw)
In-Reply-To: <20220216154950.q3uit4ucl6xupvhe@ipetronik.com>

On Wed, Feb 16, 2022 at 04:49:50PM +0100, Markus Blöchl wrote:
> > -	blk_queue_flag_set(QUEUE_FLAG_DYING, q);
> > -	blk_queue_start_drain(q);
> > +	set_bit(GD_DEAD, &disk->state);
> > +	blk_queue_start_drain(disk->queue);
> >  }
> > -EXPORT_SYMBOL_GPL(blk_set_queue_dying);
> > +EXPORT_SYMBOL_GPL(blk_mark_disk_dead);
> 
> I might have missed something here, but assuming I am a driver which
> employs multiple different queues, some with a disk attached to them,
> some without (Is that possible? The admin queue e.g.?)
> and I just lost my connection and want to notify everything below me
> that their connection is dead.
> Would I really want to kill disk queues differently from non-disk
> queues?

Yes.  Things like the admin queue in nvme are under full control of
the driver.  While the "disk" queues just get I/O from the file system
and thus need to be cut off.

> How is the admin queue killed? Is it even?

It isn't.  We just stop submitting to it.

> > --- a/drivers/block/mtip32xx/mtip32xx.c
> > +++ b/drivers/block/mtip32xx/mtip32xx.c
> > @@ -4112,7 +4112,7 @@ static void mtip_pci_remove(struct pci_dev *pdev)
> >  			"Completion workers still active!\n");
> >  	}
> >  
> > -	blk_set_queue_dying(dd->queue);
> > +	blk_mark_disk_dead(dd->disk);
> 
> This driver is weird, I did find are reliably hint that dd->disk always
> exists here. At least mtip_block_remove() has an extra check for that.

The driver is a bit of a mess indeed, but the disk and queue will be
non-NULL if ->probe returns successfully so this is fine.  It is more
that some of the checks are not required.

> It also only set QUEUE_FLAG_DEAD if it detects a surprise removal and
> not QUEUE_FLAG_DYING.

Yes, this driver will need further work.

  reply	other threads:[~2022-02-16 17:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-16 15:09 [PATCH 1/2] block: fix surprise removal for drivers calling blk_set_queue_dying Christoph Hellwig
2022-02-16 15:09 ` [PATCH 2/2] block: skip the fsync_bdev call in del_gendisk for surprise removals Christoph Hellwig
2022-02-16 15:18   ` Hannes Reinecke
2022-02-16 15:20     ` Christoph Hellwig
2022-02-16 15:31       ` Hannes Reinecke
2022-02-16 15:32   ` Markus Blöchl
2022-02-16 17:09     ` Christoph Hellwig
2022-02-16 15:37   ` Keith Busch
2022-02-16 15:45     ` Christoph Hellwig
2022-02-16 15:32 ` [PATCH 1/2] block: fix surprise removal for drivers calling blk_set_queue_dying Hannes Reinecke
2022-02-16 15:49 ` Markus Blöchl
2022-02-16 17:09   ` Christoph Hellwig [this message]
2022-02-16 18:08     ` Markus Blöchl
2022-02-16 18:10       ` Christoph Hellwig
2022-02-16 17:31 ` kernel test robot

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=20220216170919.GA20782@lst.de \
    --to=hch@lst.de \
    --cc=Markus.Bloechl@ipetronik.com \
    --cc=axboe@kernel.dk \
    --cc=kbusch@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).