NVDIMM Device and Persistent Memory development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Li Chen" <me@linux.beauty>
Cc: nvdimm@lists.linux.dev
Subject: Re: [PATCH v7 05/12] nvdimm: virtio_pmem: use GFP_NOIO for flush requests
Date: Tue, 30 Jun 2026 10:42:24 +0000	[thread overview]
Message-ID: <20260630104225.0D78C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260630092338.2094628-6-me@linux.beauty>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Dynamic allocations with `GFP_NOIO` on the block IO submission path without a mempool cause spurious IO failures under memory pressure.
--

commit 74fa63081d89bf3b9f9f1dec68f5b9b9595e7390
Author: Li Chen <me@linux.beauty>

nvdimm: virtio_pmem: use GFP_NOIO for flush requests
    
virtio_pmem_flush() can run from pmem_submit_bio() while filesystem IO
is waiting on the flush completion. The request object allocation can
sleep, but it should not enter filesystem or block IO reclaim from this
flush path.

> diff --git a/drivers/nvdimm/nd_virtio.c b/drivers/nvdimm/nd_virtio.c
> index 8e16b7780be1a..a35044afddf34 100644
> --- a/drivers/nvdimm/nd_virtio.c
> +++ b/drivers/nvdimm/nd_virtio.c
> @@ -61,7 +61,7 @@ static int virtio_pmem_flush(struct nd_region *nd_region)
>  		return -EIO;
>  	}
>  
> -	req_data = kmalloc_obj(*req_data);
> +	req_data = kmalloc_obj(*req_data, GFP_NOIO);

[Severity: High]
This is a pre-existing issue, but does this allocation lack a mempool?

Since this dynamically allocates memory on the block IO submission path
without a mempool, plain kmalloc with GFP_NOIO can fail under high
memory pressure because it does not wait indefinitely for reclaim.

When the allocation fails, virtio_pmem_flush() returns -ENOMEM, which
propagates up to pmem_submit_bio() as BLK_STS_RESOURCE. Since the block
layer does not retry BLK_STS_RESOURCE for bio-based drivers like pmem,
the error immediately propagates to the filesystem, potentially causing
unexpected data loss, read-only remounts, or journal aborts.

Should the request structure allocations here (and similarly in
async_pmem_flush()) be backed by a mempool_t to guarantee forward progress?

>  	if (!req_data)
>  		return -ENOMEM;
>

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260630092338.2094628-1-me@linux.beauty?part=5

  reply	other threads:[~2026-06-30 10:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-30  9:23 [PATCH v7 00/12] nvdimm: virtio_pmem: fix flush/request failure paths Li Chen
2026-06-30  9:23 ` [PATCH v7 01/12] nvdimm: preserve flush callback -ENOMEM Li Chen
2026-06-30  9:23 ` [PATCH v7 02/12] nvdimm: pmem: keep PREFLUSH before data writes Li Chen
2026-06-30  9:23 ` [PATCH v7 03/12] nvdimm: pmem: guard data loop for dataless bios Li Chen
2026-06-30  9:23 ` [PATCH v7 04/12] nvdimm: virtio_pmem: stop allocating child flush bio Li Chen
2026-06-30 10:28   ` sashiko-bot
2026-06-30  9:23 ` [PATCH v7 05/12] nvdimm: virtio_pmem: use GFP_NOIO for flush requests Li Chen
2026-06-30 10:42   ` sashiko-bot [this message]
2026-06-30  9:23 ` [PATCH v7 06/12] nvdimm: virtio_pmem: always wake -ENOSPC waiters Li Chen
2026-06-30  9:23 ` [PATCH v7 07/12] nvdimm: virtio_pmem: use READ_ONCE()/WRITE_ONCE() for wait flags Li Chen
2026-06-30  9:23 ` [PATCH v7 08/12] nvdimm: virtio_pmem: refcount requests for token lifetime Li Chen
2026-06-30  9:23 ` [PATCH v7 09/12] nvdimm: virtio_pmem: publish done with release/acquire Li Chen
2026-06-30  9:23 ` [PATCH v7 10/12] nvdimm: virtio_pmem: isolate DMA request buffers Li Chen
2026-06-30  9:23 ` [PATCH v7 11/12] nvdimm: virtio_pmem: converge broken virtqueue to -EIO Li Chen
2026-06-30 11:50   ` sashiko-bot
2026-06-30  9:23 ` [PATCH v7 12/12] nvdimm: virtio_pmem: drain requests in freeze Li Chen
2026-06-30  9:47 ` [PATCH v7 00/12] nvdimm: virtio_pmem: fix flush/request failure paths Pankaj Gupta

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=20260630104225.0D78C1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=me@linux.beauty \
    --cc=nvdimm@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /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