diff options
author | Benjamin Coddington <bcodding@redhat.com> | 2023-06-27 06:12:11 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@hammerspace.com> | 2023-06-29 14:25:35 -0400 |
commit | e901f17b0742e36c9d79885a912b666cc1deb210 (patch) | |
tree | 35a3ece6c5d363c5b41027a9711c58b031677efa /fs/nfs | |
parent | cded49ba366220ae7009d71c5804baa01acfb860 (diff) |
NFS: Don't cleanup sysfs superblock entry if uninitialized
Its possible to end up in nfs_free_server() before the server's superblock
sysfs entry has been initialized, in which case calling kobject_put() will
emit a WARNING. Check if the kobject has been initialized before cleaning
it up.
Fixes: 1c7251187dc0 ("NFS: add superblock sysfs entries")
Reported-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/client.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 48c9d8411c0e..e4c5f193ed5e 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -1021,8 +1021,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); |