From: Chuck Lever III <chuck.lever@oracle.com>
To: Jeff Layton <jlayton@kernel.org>
Cc: Linux NFS Mailing List <linux-nfs@vger.kernel.org>,
Neil Brown <neilb@suse.de>
Subject: Re: [PATCH v3 2/4] nfsd: rework refcounting in filecache
Date: Tue, 1 Nov 2022 13:58:11 +0000 [thread overview]
Message-ID: <494CEF8A-E9AD-400B-92E6-EEE3B2DB431D@oracle.com> (raw)
In-Reply-To: <432239da4d20337f6f14c91f40fb4432e637a662.camel@kernel.org>
> On Oct 28, 2022, at 4:13 PM, Jeff Layton <jlayton@kernel.org> wrote:
>
> On Fri, 2022-10-28 at 19:49 +0000, Chuck Lever III wrote:
>>
>>> On Oct 28, 2022, at 2:57 PM, Jeff Layton <jlayton@kernel.org> wrote:
>
>> I'm still not sold on the idea of a synchronous flush in nfsd_file_free().
>
> I think that we need to call this there to ensure that writeback errors
> are handled. I worry that if try to do this piecemeal, we could end up
> missing errors when they fall off the LRU.
>
>> That feels like a deadlock waiting to happen and quite difficult to
>> reproduce because I/O there is rarely needed. It could help to put a
>> might_sleep() in nfsd_file_fsync(), at least, but I would prefer not to
>> drive I/O in that path at all.
>
> I don't quite grok the potential for a deadlock here. nfsd_file_free
> already has to deal with blocking activities due to it effective doing a
> close(). This is just another one. That's why nfsd_file_put has a
> might_sleep in it (to warn its callers).
>
> What's the deadlock scenario you envision?
I never answered this question.
I'll say up front that I believe this problem exists in the current code
base, so what follows is meant to document an existing issue rather than
a problem with this patch series.
The filecache sets up a shrinker callback. This callback uses the same
or similar code paths as the filecache garbage collector.
Dai has found that trying to fsync inside a shrinker callback will
lead to deadlocks on some filesystems (notably I believe he was testing
btrfs at the time).
To address this, the filecache shrinker callback could avoid evicting
nfsd_file items that are open for write.
--
Chuck Lever
next prev parent reply other threads:[~2022-11-01 13:58 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-28 18:57 [PATCH v3 0/4] nfsd: clean up refcounting in the filecache Jeff Layton
2022-10-28 18:57 ` [PATCH v3 1/4] nfsd: remove the pages_flushed statistic from filecache Jeff Layton
2022-10-28 19:41 ` Chuck Lever III
2022-10-28 18:57 ` [PATCH v3 2/4] nfsd: rework refcounting in filecache Jeff Layton
2022-10-28 19:49 ` Chuck Lever III
2022-10-28 20:13 ` Jeff Layton
2022-10-28 20:39 ` Chuck Lever III
2022-10-28 21:03 ` Jeff Layton
2022-10-28 21:23 ` Chuck Lever III
2022-10-31 9:40 ` Jeff Layton
2022-11-01 13:58 ` Chuck Lever III [this message]
2022-11-01 14:19 ` Jeff Layton
2022-10-28 18:57 ` [PATCH v3 3/4] nfsd: close race between unhashing and LRU addition Jeff Layton
2022-10-28 19:50 ` Chuck Lever III
2022-10-28 20:04 ` Jeff Layton
2022-10-30 21:45 ` NeilBrown
2022-10-31 2:51 ` Chuck Lever III
2022-10-31 10:08 ` Jeff Layton
2022-10-31 13:14 ` Chuck Lever III
2022-10-31 13:28 ` Jeff Layton
2022-10-31 10:01 ` Jeff Layton
2022-10-28 18:57 ` [PATCH v3 4/4] nfsd: start non-blocking writeback after adding nfsd_file to the LRU Jeff Layton
2022-10-28 19:50 ` Chuck Lever III
2022-10-28 20:30 ` Jeff Layton
2022-10-28 20:57 ` Chuck Lever III
2022-10-31 9:36 ` Jeff Layton
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=494CEF8A-E9AD-400B-92E6-EEE3B2DB431D@oracle.com \
--to=chuck.lever@oracle.com \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
/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