From: Chuck Lever <chuck.lever@oracle.com>
To: Dai Ngo <dai.ngo@oracle.com>
Cc: Jeff Layton <jlayton@kernel.org>, Neil Brown <neilb@suse.de>,
Tom Talpey <tom@talpey.com>,
Olga Kornievskaia <okorniev@redhat.com>,
Mike Snitzer <snitzer@kernel.org>,
Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: NFSD automatically releases all states when underlying file system is unmounted
Date: Wed, 19 Mar 2025 15:24:07 -0400 [thread overview]
Message-ID: <e2b24cc2-c135-43d2-8c21-8bb59a723c5c@oracle.com> (raw)
In-Reply-To: <ba129a50-a4cc-4294-94bb-c75b13454e47@oracle.com>
On 3/19/25 3:00 PM, Dai Ngo wrote:
>
> On 3/19/25 11:28 AM, Chuck Lever wrote:
>> Hi Dai, thanks for starting this conversation.
>>
>> [ adding Mike -- IIRC localio is facing a similar issue ]
>>
>> On 3/19/25 2:22 PM, Dai Ngo wrote:
>>> Hi,
>>>
>>> Currently when the local file system needs to be unmounted for
>>> maintenance
>>> the admin needs to make sure all the NFS clients have stopped using any
>>> files
>>> on the NFS shares before the umount(8) can succeed.
>>>
>>> In an environment where there are thousands of clients this manual
>>> process
>>> seems almost impossible or impractical. The only option available now
>>> is to
>>> restart the NFS server which would works since the NFS client can
>>> recover its
>>> state but it seems like this is a big hammer approach.
>> Well we could do this instead by having the server pretend to reboot for
>> only clients that have mounted the export that is going away. That way
>> any clients that don't have an interest in the unexported/unmounted file
>> system don't have to deal with state recovery.
>
> Is there a way to restart the NFS server for just the export that's going
> away?
There is not a way do that, currently, though it's a feature that has
been discussed for years.
> How do we specify an export when doing 'systemctl restart nfs-
> server'.
I would think that the emulated restart for select exports would be
handled entirely in the kernel, and not via systemd.
>>> Ideally, when the umount command is run there is a callback from the VFS
>>> layer
>>> to notify the upper protocols; NFS and SMB, to release its states on
>>> this file
>>> system for the umount to complete.
>>>
>>> Is there any existing mechanism to allow NFSD to release its states
>>> automatically on unmount?
>> Can you explain why you don't believe unexport is the right place to
>> trigger remote file closure?
>
> Yes, unexport is another place that can be enhanced to trigger the
> releasing
> of all states of the export that going away. For this to work, the downcall
> mechanism between exportfs and the kernel needs to be enhanced to specify
> the export that is going away. This approach would eliminate the need for
> VFS involvement.
>
> Currently when 'exportfs -u' is called, exportfs makes a downcall to the
> kernel to clear the cache of ALL exports and not just the one that going
> away.
Clearing the export cache is OK. That just means that new client
requests will trigger an upcall tp repopulate the kernel's export cache.
That is a much smaller bump in the performance road than a full server
restart.
--
Chuck Lever
next prev parent reply other threads:[~2025-03-19 19:24 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-19 18:22 NFSD automatically releases all states when underlying file system is unmounted Dai Ngo
2025-03-19 18:28 ` Chuck Lever
2025-03-19 19:00 ` Dai Ngo
2025-03-19 19:24 ` Chuck Lever [this message]
2025-03-19 19:44 ` Dai Ngo
2025-03-19 21:46 ` NeilBrown
2025-03-19 22:12 ` Dai Ngo
2025-03-20 17:53 ` Chuck Lever
2025-03-21 14:36 ` Benjamin Coddington
2025-03-21 14:43 ` Jeff Layton
2025-03-21 15:07 ` Benjamin Coddington
2025-03-21 15:18 ` Chuck Lever
2025-03-21 15:51 ` Benjamin Coddington
2025-03-21 14:44 ` Chuck Lever
2025-03-26 0:23 ` NeilBrown
2025-03-26 3:20 ` Dai Ngo
2025-03-26 3:41 ` NeilBrown
2025-03-26 13:15 ` Chuck Lever
2025-03-27 22:47 ` NeilBrown
2025-04-09 21:00 ` Dai Ngo
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=e2b24cc2-c135-43d2-8c21-8bb59a723c5c@oracle.com \
--to=chuck.lever@oracle.com \
--cc=dai.ngo@oracle.com \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=okorniev@redhat.com \
--cc=snitzer@kernel.org \
--cc=tom@talpey.com \
/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