diff options
Diffstat (limited to 'fs/nfsd/nfsctl.c')
| -rw-r--r-- | fs/nfsd/nfsctl.c | 54 | 
1 files changed, 14 insertions, 40 deletions
| diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 917fa1892fd2..6a29bcfc9390 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -185,17 +185,7 @@ static int export_features_show(struct seq_file *m, void *v)  	return 0;  } -static int export_features_open(struct inode *inode, struct file *file) -{ -	return single_open(file, export_features_show, NULL); -} - -static const struct file_operations export_features_operations = { -	.open		= export_features_open, -	.read		= seq_read, -	.llseek		= seq_lseek, -	.release	= single_release, -}; +DEFINE_SHOW_ATTRIBUTE(export_features);  #if defined(CONFIG_SUNRPC_GSS) || defined(CONFIG_SUNRPC_GSS_MODULE)  static int supported_enctypes_show(struct seq_file *m, void *v) @@ -204,17 +194,7 @@ static int supported_enctypes_show(struct seq_file *m, void *v)  	return 0;  } -static int supported_enctypes_open(struct inode *inode, struct file *file) -{ -	return single_open(file, supported_enctypes_show, NULL); -} - -static const struct file_operations supported_enctypes_ops = { -	.open		= supported_enctypes_open, -	.read		= seq_read, -	.llseek		= seq_lseek, -	.release	= single_release, -}; +DEFINE_SHOW_ATTRIBUTE(supported_enctypes);  #endif /* CONFIG_SUNRPC_GSS or CONFIG_SUNRPC_GSS_MODULE */  static const struct file_operations pool_stats_operations = { @@ -224,19 +204,9 @@ static const struct file_operations pool_stats_operations = {  	.release	= nfsd_pool_stats_release,  }; -static const struct file_operations reply_cache_stats_operations = { -	.open		= nfsd_reply_cache_stats_open, -	.read		= seq_read, -	.llseek		= seq_lseek, -	.release	= single_release, -}; +DEFINE_SHOW_ATTRIBUTE(nfsd_reply_cache_stats); -static const struct file_operations filecache_ops = { -	.open		= nfsd_file_cache_stats_open, -	.read		= seq_read, -	.llseek		= seq_lseek, -	.release	= single_release, -}; +DEFINE_SHOW_ATTRIBUTE(nfsd_file_cache_stats);  /*----------------------------------------------------------------------------*/  /* @@ -1365,7 +1335,7 @@ static int nfsd_fill_super(struct super_block *sb, struct fs_context *fc)  		/* Per-export io stats use same ops as exports file */  		[NFSD_Export_Stats] = {"export_stats", &exports_nfsd_operations, S_IRUGO},  		[NFSD_Export_features] = {"export_features", -					&export_features_operations, S_IRUGO}, +					&export_features_fops, S_IRUGO},  		[NFSD_FO_UnlockIP] = {"unlock_ip",  					&transaction_ops, S_IWUSR|S_IRUSR},  		[NFSD_FO_UnlockFS] = {"unlock_filesystem", @@ -1374,14 +1344,16 @@ static int nfsd_fill_super(struct super_block *sb, struct fs_context *fc)  		[NFSD_Threads] = {"threads", &transaction_ops, S_IWUSR|S_IRUSR},  		[NFSD_Pool_Threads] = {"pool_threads", &transaction_ops, S_IWUSR|S_IRUSR},  		[NFSD_Pool_Stats] = {"pool_stats", &pool_stats_operations, S_IRUGO}, -		[NFSD_Reply_Cache_Stats] = {"reply_cache_stats", &reply_cache_stats_operations, S_IRUGO}, +		[NFSD_Reply_Cache_Stats] = {"reply_cache_stats", +					&nfsd_reply_cache_stats_fops, S_IRUGO},  		[NFSD_Versions] = {"versions", &transaction_ops, S_IWUSR|S_IRUSR},  		[NFSD_Ports] = {"portlist", &transaction_ops, S_IWUSR|S_IRUGO},  		[NFSD_MaxBlkSize] = {"max_block_size", &transaction_ops, S_IWUSR|S_IRUGO},  		[NFSD_MaxConnections] = {"max_connections", &transaction_ops, S_IWUSR|S_IRUGO}, -		[NFSD_Filecache] = {"filecache", &filecache_ops, S_IRUGO}, +		[NFSD_Filecache] = {"filecache", &nfsd_file_cache_stats_fops, S_IRUGO},  #if defined(CONFIG_SUNRPC_GSS) || defined(CONFIG_SUNRPC_GSS_MODULE) -		[NFSD_SupportedEnctypes] = {"supported_krb5_enctypes", &supported_enctypes_ops, S_IRUGO}, +		[NFSD_SupportedEnctypes] = {"supported_krb5_enctypes", +					&supported_enctypes_fops, S_IRUGO},  #endif /* CONFIG_SUNRPC_GSS or CONFIG_SUNRPC_GSS_MODULE */  #ifdef CONFIG_NFSD_V4  		[NFSD_Leasetime] = {"nfsv4leasetime", &transaction_ops, S_IWUSR|S_IRUSR}, @@ -1481,11 +1453,12 @@ static __net_init int nfsd_init_net(struct net *net)  		goto out_idmap_error;  	nn->nfsd_versions = NULL;  	nn->nfsd4_minorversions = NULL; +	retval = nfsd4_init_leases_net(nn); +	if (retval) +		goto out_drc_error;  	retval = nfsd_reply_cache_init(nn);  	if (retval)  		goto out_drc_error; -	nfsd4_init_leases_net(nn); -  	get_random_bytes(&nn->siphash_key, sizeof(nn->siphash_key));  	seqlock_init(&nn->writeverf_lock); @@ -1507,6 +1480,7 @@ static __net_exit void nfsd_exit_net(struct net *net)  	nfsd_idmap_shutdown(net);  	nfsd_export_shutdown(net);  	nfsd_netns_free_versions(net_generic(net, nfsd_net_id)); +	nfsd4_leases_net_shutdown(nn);  }  static struct pernet_operations nfsd_net_ops = { |