diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2012-04-11 07:13:35 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2012-04-12 09:11:47 -0400 |
commit | 5717e0128422b96be6aa414fa752ec90c1cd31e9 (patch) | |
tree | 015b3be152cf778b585625810dce7c36f876e2fb | |
parent | e5f06f720eff24e32f1cc08ec03bcc8c4b2d2934 (diff) |
nfsd: allocate export and expkey caches in per-net operations.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r-- | fs/nfsd/nfsctl.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index b14417740816..08cd87a9fb40 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -1137,7 +1137,28 @@ static int create_proc_exports_entry(void) | |||
1137 | #endif | 1137 | #endif |
1138 | 1138 | ||
1139 | int nfsd_net_id; | 1139 | int nfsd_net_id; |
1140 | |||
1141 | static __net_init int nfsd_init_net(struct net *net) | ||
1142 | { | ||
1143 | int retval; | ||
1144 | |||
1145 | retval = nfsd_export_init(net); | ||
1146 | if (retval) | ||
1147 | goto out_export_error; | ||
1148 | return 0; | ||
1149 | |||
1150 | out_export_error: | ||
1151 | return retval; | ||
1152 | } | ||
1153 | |||
1154 | static __net_exit void nfsd_exit_net(struct net *net) | ||
1155 | { | ||
1156 | nfsd_export_shutdown(net); | ||
1157 | } | ||
1158 | |||
1140 | static struct pernet_operations nfsd_net_ops = { | 1159 | static struct pernet_operations nfsd_net_ops = { |
1160 | .init = nfsd_init_net, | ||
1161 | .exit = nfsd_exit_net, | ||
1141 | .id = &nfsd_net_id, | 1162 | .id = &nfsd_net_id, |
1142 | .size = sizeof(struct nfsd_net), | 1163 | .size = sizeof(struct nfsd_net), |
1143 | }; | 1164 | }; |
@@ -1164,9 +1185,6 @@ static int __init init_nfsd(void) | |||
1164 | retval = nfsd_reply_cache_init(); | 1185 | retval = nfsd_reply_cache_init(); |
1165 | if (retval) | 1186 | if (retval) |
1166 | goto out_free_stat; | 1187 | goto out_free_stat; |
1167 | retval = nfsd_export_init(&init_net); | ||
1168 | if (retval) | ||
1169 | goto out_free_cache; | ||
1170 | nfsd_lockd_init(); /* lockd->nfsd callbacks */ | 1188 | nfsd_lockd_init(); /* lockd->nfsd callbacks */ |
1171 | retval = nfsd_idmap_init(); | 1189 | retval = nfsd_idmap_init(); |
1172 | if (retval) | 1190 | if (retval) |
@@ -1185,8 +1203,6 @@ out_free_idmap: | |||
1185 | nfsd_idmap_shutdown(); | 1203 | nfsd_idmap_shutdown(); |
1186 | out_free_lockd: | 1204 | out_free_lockd: |
1187 | nfsd_lockd_shutdown(); | 1205 | nfsd_lockd_shutdown(); |
1188 | nfsd_export_shutdown(&init_net); | ||
1189 | out_free_cache: | ||
1190 | nfsd_reply_cache_shutdown(); | 1206 | nfsd_reply_cache_shutdown(); |
1191 | out_free_stat: | 1207 | out_free_stat: |
1192 | nfsd_stat_shutdown(); | 1208 | nfsd_stat_shutdown(); |
@@ -1202,7 +1218,6 @@ out_unregister_notifier: | |||
1202 | 1218 | ||
1203 | static void __exit exit_nfsd(void) | 1219 | static void __exit exit_nfsd(void) |
1204 | { | 1220 | { |
1205 | nfsd_export_shutdown(&init_net); | ||
1206 | nfsd_reply_cache_shutdown(); | 1221 | nfsd_reply_cache_shutdown(); |
1207 | remove_proc_entry("fs/nfs/exports", NULL); | 1222 | remove_proc_entry("fs/nfs/exports", NULL); |
1208 | remove_proc_entry("fs/nfs", NULL); | 1223 | remove_proc_entry("fs/nfs", NULL); |