linux-stable/drivers/nvdimm
Hou Tao e39e870e1e virtio_pmem: add the missing REQ_OP_WRITE for flush bio
commit c1dbd8a849 upstream.

When doing mkfs.xfs on a pmem device, the following warning was
reported:

 ------------[ cut here ]------------
 WARNING: CPU: 2 PID: 384 at block/blk-core.c:751 submit_bio_noacct
 Modules linked in:
 CPU: 2 PID: 384 Comm: mkfs.xfs Not tainted 6.4.0-rc7+ #154
 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
 RIP: 0010:submit_bio_noacct+0x340/0x520
 ......
 Call Trace:
  <TASK>
  ? submit_bio_noacct+0xd5/0x520
  submit_bio+0x37/0x60
  async_pmem_flush+0x79/0xa0
  nvdimm_flush+0x17/0x40
  pmem_submit_bio+0x370/0x390
  __submit_bio+0xbc/0x190
  submit_bio_noacct_nocheck+0x14d/0x370
  submit_bio_noacct+0x1ef/0x520
  submit_bio+0x55/0x60
  submit_bio_wait+0x5a/0xc0
  blkdev_issue_flush+0x44/0x60

The root cause is that submit_bio_noacct() needs bio_op() is either
WRITE or ZONE_APPEND for flush bio and async_pmem_flush() doesn't assign
REQ_OP_WRITE when allocating flush bio, so submit_bio_noacct just fail
the flush bio.

Simply fix it by adding the missing REQ_OP_WRITE for flush bio. And we
could fix the flush order issue and do flush optimization later.

Cc: stable@vger.kernel.org # 6.3+
Fixes: b4a6bb3a67 ("block: add a sanity check for non-write flush/fua bios")
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Pankaj Gupta <pankaj.gupta@amd.com>
Tested-by: Pankaj Gupta <pankaj.gupta@amd.com>
Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-09-13 09:48:38 +02:00
..
badrange.c
btt.c block: remove ->rw_page 2023-02-02 22:33:34 -08:00
btt.h
btt_devs.c
bus.c driver core: class: remove module * from class_create() 2023-03-17 15:16:33 +01:00
claim.c
core.c
dax_devs.c driver core: make struct bus_type.uevent() take a const * 2023-01-27 13:45:52 +01:00
dimm.c
dimm_devs.c cxl for v6.3 2023-02-25 09:19:23 -08:00
e820.c
Kconfig nvdimm: Support sizeof(struct page) > MAX_STRUCT_PAGE_SIZE 2023-01-28 15:32:36 -08:00
label.c
label.h
Makefile
namespace_devs.c
nd-core.h cxl for v6.3 2023-02-25 09:19:23 -08:00
nd.h Driver core changes for 6.3-rc1 2023-02-24 12:58:55 -08:00
nd_perf.c nvdimm: Fix dereference after free in register_nvdimm_pmu() 2023-09-13 09:48:23 +02:00
nd_virtio.c virtio_pmem: add the missing REQ_OP_WRITE for flush bio 2023-09-13 09:48:38 +02:00
of_pmem.c
pfn.h
pfn_devs.c nvdimm: Support sizeof(struct page) > MAX_STRUCT_PAGE_SIZE 2023-01-28 15:32:36 -08:00
pmem.c block: remove ->rw_page 2023-02-02 22:33:34 -08:00
pmem.h
region.c nvdimm/region: Move cache management to the region driver 2022-12-02 23:52:32 -08:00
region_devs.c driver core: make struct bus_type.uevent() take a const * 2023-01-27 13:45:52 +01:00
security.c nvdimm/region: Move cache management to the region driver 2022-12-02 23:52:32 -08:00
virtio_pmem.c virtio_pmem: populate numa information 2023-02-15 06:46:22 -05:00
virtio_pmem.h