@@ -178,7 +178,7 @@ static const struct file_operations pool_stats_operations = {
.open = nfsd_pool_stats_open,
.read = seq_read,
.llseek = seq_lseek,
- .release = nfsd_pool_stats_release,
+ .release = nfsd_stats_release,
};
DEFINE_SHOW_ATTRIBUTE(nfsd_reply_cache_stats);
@@ -93,7 +93,7 @@ int nfsd_nrpools(struct net *);
int nfsd_get_nrthreads(int n, int *, struct net *);
int nfsd_set_nrthreads(int n, int *, struct net *);
int nfsd_pool_stats_open(struct inode *, struct file *);
-int nfsd_pool_stats_release(struct inode *, struct file *);
+int nfsd_stats_release(struct inode *, struct file *);
void nfsd_shutdown_threads(struct net *net);
static inline void nfsd_put(struct net *net)
@@ -1064,23 +1064,34 @@ bool nfssvc_encode_voidres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
return true;
}
-int nfsd_pool_stats_open(struct inode *inode, struct file *file)
+static int nfsd_stats_open(struct inode *inode)
{
- int ret;
struct nfsd_net *nn = net_generic(inode->i_sb->s_fs_info, nfsd_net_id);
mutex_lock(&nfsd_mutex);
- if (nn->nfsd_serv == NULL) {
+ if (!nn->nfsd_serv) {
mutex_unlock(&nfsd_mutex);
return -ENODEV;
}
+
svc_get(nn->nfsd_serv);
- ret = svc_pool_stats_open(nn->nfsd_serv, file);
mutex_unlock(&nfsd_mutex);
- return ret;
+
+ return 0;
+}
+
+int nfsd_pool_stats_open(struct inode *inode, struct file *file)
+{
+ struct nfsd_net *nn = net_generic(inode->i_sb->s_fs_info, nfsd_net_id);
+ int ret = nfsd_stats_open(inode);
+
+ if (ret)
+ return ret;
+
+ return svc_pool_stats_open(nn->nfsd_serv, file);
}
-int nfsd_pool_stats_release(struct inode *inode, struct file *file)
+int nfsd_stats_release(struct inode *inode, struct file *file)
{
int ret = seq_release(inode, file);
struct net *net = inode->i_sb->s_fs_info;