diff mbox

[08/11] nvme: suspend i/o during runtime blk_integrity_unregister

Message ID 20151014022841.34443.28017.stgit@dwillia2-desk3.jf.intel.com (mailing list archive)
State Superseded
Headers show

Commit Message

Dan Williams Oct. 14, 2015, 2:28 a.m. UTC
Synchronize pending i/o against a change in the integrity profile to
avoid the possibility of spurious integrity errors.

Cc: Keith Busch <keith.busch@intel.com>
Cc: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/nvme/host/pci.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Keith Busch Oct. 14, 2015, 1:59 p.m. UTC | #1
On Tue, 13 Oct 2015, Dan Williams wrote:
> Synchronize pending i/o against a change in the integrity profile to
> avoid the possibility of spurious integrity errors.

Looks good. Do we need to freeze the queue if we are register an
integrity profile as well?

> Cc: Keith Busch <keith.busch@intel.com>
> Cc: Matthew Wilcox <willy@linux.intel.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
> drivers/nvme/host/pci.c |    5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 65190e51aa47..7e6577f6ace6 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -2036,8 +2036,11 @@ static int nvme_revalidate_disk(struct gendisk *disk)
> 	if (blk_get_integrity(disk) && (ns->pi_type != pi_type ||
> 				ns->ms != old_ms ||
> 				bs != queue_logical_block_size(disk->queue) ||
> -				(ns->ms && ns->ext)))
> +				(ns->ms && ns->ext))) {
> +		blk_mq_freeze_queue(disk->queue);
> 		blk_integrity_unregister(disk);
> +		blk_mq_unfreeze_queue(disk->queue);
> +	}
>
> 	ns->pi_type = pi_type;
> 	blk_queue_logical_block_size(ns->queue, bs);
>
>
Dan Williams Oct. 14, 2015, 6:17 p.m. UTC | #2
On Wed, Oct 14, 2015 at 6:59 AM, Keith Busch <keith.busch@intel.com> wrote:
> On Tue, 13 Oct 2015, Dan Williams wrote:
>>
>> Synchronize pending i/o against a change in the integrity profile to
>> avoid the possibility of spurious integrity errors.
>
>
> Looks good. Do we need to freeze the queue if we are register an
> integrity profile as well?
>

Indeed we do, I'll refresh the patch.  Thanks for that catch.
diff mbox

Patch

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 65190e51aa47..7e6577f6ace6 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2036,8 +2036,11 @@  static int nvme_revalidate_disk(struct gendisk *disk)
 	if (blk_get_integrity(disk) && (ns->pi_type != pi_type ||
 				ns->ms != old_ms ||
 				bs != queue_logical_block_size(disk->queue) ||
-				(ns->ms && ns->ext)))
+				(ns->ms && ns->ext))) {
+		blk_mq_freeze_queue(disk->queue);
 		blk_integrity_unregister(disk);
+		blk_mq_unfreeze_queue(disk->queue);
+	}
 
 	ns->pi_type = pi_type;
 	blk_queue_logical_block_size(ns->queue, bs);