From: Nathan Chancellor <nathan@kernel.org>
To: Benjamin Coddington <bcodding@redhat.com>
Cc: linux-nfs@vger.kernel.org, Trond Myklebust <trondmy@gmail.com>
Subject: Re: [PATCH v4 05/11] NFS: add superblock sysfs entries
Date: Mon, 26 Jun 2023 15:25:11 -0700 [thread overview]
Message-ID: <20230626222511.GA508950@dev-arch.thelio-3990X> (raw)
In-Reply-To: <BB4C7A5D-BC97-4422-B5DE-D9267EB29882@redhat.com>
On Mon, Jun 26, 2023 at 05:47:21PM -0400, Benjamin Coddington wrote:
> On 26 Jun 2023, at 17:12, Nathan Chancellor wrote:
>
> > Hi Benjamin,
> >
> > On Thu, Jun 15, 2023 at 02:07:26PM -0400, Benjamin Coddington wrote:
> >> Create a sysfs directory for each mount that corresponds to the mount's
> >> nfs_server struct. As the mount is being constructed, use the name
> >> "server-n", but rename it to the "MAJOR:MINOR" of the mount after assigning
> >> a device_id. The rename approach allows us to populate the mount's directory
> >> with links to the various rpc_client objects during the mount's
> >> construction. The naming convention (MAJOR:MINOR) can be used to reference
> >> a particular NFS mount's sysfs tree.
> >>
> >> Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
> >
> > I am not sure if this has been reported or fixed already, so I apologize
> > if this is a duplicate. After this change landed in -next as commit
> > 1c7251187dc0 ("NFS: add superblock sysfs entries"), I see the following
> > splat when accessing a NFS server:
>
> Hi Nathan, oh yes - I see there are a few paths through nfs4_init_server()
> where we can exit early due to an error or duplicate client, in which case
> nfs_free_server() tries to clean up the server kobject before it has been
> initialized.
>
> I think we can simply do:
>
> diff --git a/fs/nfs/client.c b/fs/nfs/client.c
> index 4967ac800b14..4046072663f2 100644
> --- a/fs/nfs/client.c
> +++ b/fs/nfs/client.c
> @@ -1013,8 +1013,10 @@ void nfs_free_server(struct nfs_server *server)
>
> nfs_put_client(server->nfs_client);
>
> - nfs_sysfs_remove_server(server);
> - kobject_put(&server->kobj);
> + if (server->kobj.state_initialized) {
> + nfs_sysfs_remove_server(server);
> + kobject_put(&server->kobj);
> + }
> ida_free(&s_sysfs_ids, server->s_sysfs_id);
>
> ida_destroy(&server->lockowner_id);
>
> Are you able to test that? If not, totally fine - I think I should be able
> to reproduce the problem and send a patch.
Yes, that appears to work for me! Feel free to add
Tested-by: Nathan Chancellor <nathan@kernel.org>
to that diff if you send it along formally.
Cheers,
Nathan
next prev parent reply other threads:[~2023-06-26 22:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-15 18:07 [PATCH v4 00/11] NFS sysfs scaffolding Benjamin Coddington
2023-06-15 18:07 ` [PATCH v4 01/11] NFS: rename nfs_client_kset to nfs_kset Benjamin Coddington
2023-06-15 18:07 ` [PATCH v4 02/11] NFS: rename nfs_client_kobj to nfs_net_kobj Benjamin Coddington
2023-06-15 18:07 ` [PATCH v4 03/11] NFS: Open-code the nfs_kset kset_create_and_add() Benjamin Coddington
2023-06-15 18:07 ` [PATCH v4 04/11] NFS: Make all of /sys/fs/nfs network-namespace unique Benjamin Coddington
2023-06-15 18:07 ` [PATCH v4 05/11] NFS: add superblock sysfs entries Benjamin Coddington
2023-06-26 21:12 ` Nathan Chancellor
2023-06-26 21:47 ` Benjamin Coddington
2023-06-26 22:25 ` Nathan Chancellor [this message]
2023-06-15 18:07 ` [PATCH v4 06/11] NFS: Add sysfs links to sunrpc clients for nfs_clients Benjamin Coddington
2023-06-15 18:07 ` [PATCH v4 07/11] NFS: add a sysfs link to the lockd rpc_client Benjamin Coddington
2023-06-15 18:07 ` [PATCH v4 08/11] NFS: add a sysfs link to the acl rpc_client Benjamin Coddington
2023-06-15 18:07 ` [PATCH v4 09/11] NFS: add sysfs shutdown knob Benjamin Coddington
2023-06-15 18:07 ` [PATCH v4 10/11] NFS: Cancel all existing RPC tasks when shutdown Benjamin Coddington
2023-06-15 18:07 ` [PATCH v4 11/11] NFSv4: Clean up some shutdown loops Benjamin Coddington
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=20230626222511.GA508950@dev-arch.thelio-3990X \
--to=nathan@kernel.org \
--cc=bcodding@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trondmy@gmail.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