Linux NFS development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Benjamin Coddington <bcodding@redhat.com>,
	Trond Myklebust	 <trondmy@kernel.org>,
	Anna Schumaker <anna@kernel.org>, Tejun Heo <tj@kernel.org>,
	 Lai Jiangshan <jiangshanlai@gmail.com>
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	 djeffery@redhat.com, loberman@redhat.com
Subject: Re: [PATCH 0/2] Fix loopback mounted filesystems on NFS
Date: Mon, 07 Jul 2025 15:15:08 -0400	[thread overview]
Message-ID: <6ff11be02537c1251a2725bdf4ecbb1fcfca79e1.camel@kernel.org> (raw)
In-Reply-To: <cover.1751913604.git.bcodding@redhat.com>

On Mon, 2025-07-07 at 14:46 -0400, Benjamin Coddington wrote:
> We've been investigating new reports of filesystem corruption on
> loopback images on NFS clients.  It appears that during writeback the
> loopback driver encounters allocation failures in NFS and fails to write
> dirty pages to the backing file.
> 
> We believe the problem is due to the loopback driver performing writeback
> from a workqueue (so PF_WQ_WORKER is set), however ever since work to
> improve NFS' memory allocation strategies [1] its possible that NFS
> incorrectly assumes that if PF_WQ_WORKER is set then the writeback context
> is nfsiod.  To make things worse, NFS does not expect PF_WQ_WORKER to be set
> along with other PF_ flags such as PF_MEMALLOC_NOIO, but cannot really know
> (without checking them all) which other allocation flags are set should
> writeback be entered from a NFS-external workqueue worker.
> 
> To fix this, I'd like to introduce a way to check which specific workqueue
> is being served by a worker (in patch 1), so that NFS can ensure that it
> sets certain allocation flags only for the nfsiod workqueue workers (in
> patch 2).
> 
> [1]: https://lore.kernel.org/linux-nfs/20220322011618.1052288-1-trondmy@kernel.org/
> 
> Benjamin Coddington (2):
>   workqueue: Add a helper to identify current workqueue
>   NFS: Improve nfsiod workqueue detection for allocation flags
> 
>  fs/nfs/internal.h         | 12 +++++++++++-
>  include/linux/workqueue.h |  1 +
>  kernel/workqueue.c        | 18 ++++++++++++++++++
>  3 files changed, 30 insertions(+), 1 deletion(-)

Looks like a nice simple solution, and the workqueue helper seems
reasonable.

Reviewed-by: Jeff Layton <jlayton@kernel.org>

      parent reply	other threads:[~2025-07-07 19:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-07 18:46 [PATCH 0/2] Fix loopback mounted filesystems on NFS Benjamin Coddington
2025-07-07 18:46 ` [PATCH 1/2] workqueue: Add a helper to identify current workqueue Benjamin Coddington
2025-07-08  4:37   ` Tejun Heo
2025-07-08 10:25     ` Benjamin Coddington
2025-07-07 18:46 ` [PATCH 2/2] NFS: Improve nfsiod workqueue detection for allocation flags Benjamin Coddington
2025-07-07 19:25   ` Trond Myklebust
2025-07-07 20:12     ` Benjamin Coddington
2025-07-07 20:42       ` Trond Myklebust
2025-07-07 20:28     ` Laurence Oberman
2025-07-08 16:50       ` Laurence Oberman
2025-07-08 17:03         ` Benjamin Coddington
2025-07-08 17:09           ` Laurence Oberman
     [not found]             ` <F889E706-9B2B-48CA-B30E-60FB5EFE2578@redhat.com>
2025-07-09 14:36               ` [PATCH] NFS: Fixup allocation flags for nfsiod's __GFP_NORETRY Laurence Oberman
2025-07-07 19:15 ` Jeff Layton [this message]

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=6ff11be02537c1251a2725bdf4ecbb1fcfca79e1.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=anna@kernel.org \
    --cc=bcodding@redhat.com \
    --cc=djeffery@redhat.com \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=loberman@redhat.com \
    --cc=tj@kernel.org \
    --cc=trondmy@kernel.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