nvdimm/pmem: stop using q_usage_count as external pgmap refcount
authorChristoph Hellwig <hch@lst.de>
Tue, 19 Oct 2021 07:36:40 +0000 (09:36 +0200)
committerDan Williams <dan.j.williams@intel.com>
Mon, 25 Oct 2021 23:12:32 +0000 (16:12 -0700)
commit3dd60fb9d95db9c78fec86ba4df20852a7b974ba
treed69b8eaa5b297bb70528c7a0a8290ebd65c24be6
parent3906fe9bb7f1a2c8667ae54e967dc8690824f4ea
nvdimm/pmem: stop using q_usage_count as external pgmap refcount

Originally all DAX access when through block_device operations and thus
needed a queue reference.  But since commit cccbce671582
("filesystem-dax: convert to dax_direct_access()") all this happens at
the DAX device level which uses its own refcounting.  Having the external
refcount thus wasn't needed but has otherwise been harmless for long
time.

But now that "block: drain file system I/O on del_gendisk" waits for
q_usage_count to reach 0 in del_gendisk this whole scheme can't work
anymore (and pmem is the only driver abusing q_usage_count like that).
So switch to the internal reference and remove the unbalanced
blk_freeze_queue_start that is taken care of by del_gendisk.

Fixes: 8e141f9eb803 ("block: drain file system I/O on del_gendisk")
Reported-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20211019073641.2323410-2-hch@lst.de
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/nvdimm/pmem.c