diff options
| author | Anna Schumaker <anna.schumaker@oracle.com> | 2024-10-01 16:33:44 -0400 |
|---|---|---|
| committer | Trond Myklebust <trond.myklebust@hammerspace.com> | 2024-11-08 14:17:37 -0500 |
| commit | 288d7224db0c2a85bda4e2227fad3f6eb89e2874 (patch) | |
| tree | bf54730d538864718ceeb43c00a2f8be8d7e76b8 /fs/nfs/client.c | |
| parent | 3c91e4b7ae902bd5c05c14ff6fe74acd0bdd237a (diff) | |
NFS: Implement get_nfs_version()
This is a pair for put_nfs_version(), and is used for incrementing the
reference count on the nfs version module. I also updated the callers I
could find who had this hardcoded up until now.
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'fs/nfs/client.c')
| -rw-r--r-- | fs/nfs/client.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 4c94fe419c40..550ca934c9cf 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -100,12 +100,18 @@ struct nfs_subversion *find_nfs_version(unsigned int version) if (!nfs) return ERR_PTR(-EPROTONOSUPPORT); - if (!try_module_get(nfs->owner)) + if (!get_nfs_version(nfs)) return ERR_PTR(-EAGAIN); return nfs; } +int get_nfs_version(struct nfs_subversion *nfs) +{ + return try_module_get(nfs->owner); +} +EXPORT_SYMBOL_GPL(get_nfs_version); + void put_nfs_version(struct nfs_subversion *nfs) { module_put(nfs->owner); @@ -149,7 +155,7 @@ struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_init) clp->cl_minorversion = cl_init->minorversion; clp->cl_nfs_mod = cl_init->nfs_mod; - if (!try_module_get(clp->cl_nfs_mod->owner)) + if (!get_nfs_version(clp->cl_nfs_mod)) goto error_dealloc; clp->rpc_ops = clp->cl_nfs_mod->rpc_ops; |