aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Schumaker <bjschuma@netapp.com>2012-06-20 15:53:41 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-06-29 11:46:44 -0400
commiteeebf91675421b730448489ebf4720e5c419beec (patch)
tree84287ae7c6afaa29b5139e39c72a2c137f01bbf5
parente38eb6506ff426a2bb93433fecfcc863a95fcd03 (diff)
NFS: Use nfs4_destroy_server() to clean up NFS v4
I can use this function to return delegations and unset the pnfs layout driver rather than continuing to do these things in the generic client. With this change, we no longer need an nfs4_kill_super(). Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/nfs/client.c3
-rw-r--r--fs/nfs/delegation.c3
-rw-r--r--fs/nfs/delegation.h2
-rw-r--r--fs/nfs/super.c23
4 files changed, 9 insertions, 22 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index e646b14024c1..bf0f896284a8 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -266,6 +266,8 @@ static void pnfs_init_server(struct nfs_server *server)
266 266
267static void nfs4_destroy_server(struct nfs_server *server) 267static void nfs4_destroy_server(struct nfs_server *server)
268{ 268{
269 nfs_server_return_all_delegations(server);
270 unset_pnfs_layoutdriver(server);
269 nfs4_purge_state_owners(server); 271 nfs4_purge_state_owners(server);
270} 272}
271 273
@@ -1137,7 +1139,6 @@ void nfs_free_server(struct nfs_server *server)
1137 dprintk("--> nfs_free_server()\n"); 1139 dprintk("--> nfs_free_server()\n");
1138 1140
1139 nfs_server_remove_lists(server); 1141 nfs_server_remove_lists(server);
1140 unset_pnfs_layoutdriver(server);
1141 1142
1142 if (server->destroy != NULL) 1143 if (server->destroy != NULL)
1143 server->destroy(server); 1144 server->destroy(server);
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index bd3a9601d32d..9a7a1b488af9 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -417,9 +417,8 @@ static void nfs_mark_return_delegation(struct nfs_server *server,
417 * @sb: sb to process 417 * @sb: sb to process
418 * 418 *
419 */ 419 */
420void nfs_super_return_all_delegations(struct super_block *sb) 420void nfs_server_return_all_delegations(struct nfs_server *server)
421{ 421{
422 struct nfs_server *server = NFS_SB(sb);
423 struct nfs_client *clp = server->nfs_client; 422 struct nfs_client *clp = server->nfs_client;
424 struct nfs_delegation *delegation; 423 struct nfs_delegation *delegation;
425 424
diff --git a/fs/nfs/delegation.h b/fs/nfs/delegation.h
index 72709c4193fa..206db5679996 100644
--- a/fs/nfs/delegation.h
+++ b/fs/nfs/delegation.h
@@ -38,7 +38,7 @@ int nfs_async_inode_return_delegation(struct inode *inode, const nfs4_stateid *s
38void nfs_inode_return_delegation_noreclaim(struct inode *inode); 38void nfs_inode_return_delegation_noreclaim(struct inode *inode);
39 39
40struct inode *nfs_delegation_find_inode(struct nfs_client *clp, const struct nfs_fh *fhandle); 40struct inode *nfs_delegation_find_inode(struct nfs_client *clp, const struct nfs_fh *fhandle);
41void nfs_super_return_all_delegations(struct super_block *sb); 41void nfs_server_return_all_delegations(struct nfs_server *);
42void nfs_expire_all_delegations(struct nfs_client *clp); 42void nfs_expire_all_delegations(struct nfs_client *clp);
43void nfs_expire_all_delegation_types(struct nfs_client *clp, fmode_t flags); 43void nfs_expire_all_delegation_types(struct nfs_client *clp, fmode_t flags);
44void nfs_expire_unreferenced_delegations(struct nfs_client *clp); 44void nfs_expire_unreferenced_delegations(struct nfs_client *clp);
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 906f09c7d842..5a1c860743c3 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -347,13 +347,12 @@ static struct dentry *nfs4_referral_mount(struct file_system_type *fs_type,
347 int flags, const char *dev_name, void *raw_data); 347 int flags, const char *dev_name, void *raw_data);
348static struct dentry *nfs4_remote_referral_mount(struct file_system_type *fs_type, 348static struct dentry *nfs4_remote_referral_mount(struct file_system_type *fs_type,
349 int flags, const char *dev_name, void *raw_data); 349 int flags, const char *dev_name, void *raw_data);
350static void nfs4_kill_super(struct super_block *sb);
351 350
352static struct file_system_type nfs4_fs_type = { 351static struct file_system_type nfs4_fs_type = {
353 .owner = THIS_MODULE, 352 .owner = THIS_MODULE,
354 .name = "nfs4", 353 .name = "nfs4",
355 .mount = nfs_fs_mount, 354 .mount = nfs_fs_mount,
356 .kill_sb = nfs4_kill_super, 355 .kill_sb = nfs_kill_super,
357 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, 356 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
358}; 357};
359 358
@@ -361,7 +360,7 @@ static struct file_system_type nfs4_remote_fs_type = {
361 .owner = THIS_MODULE, 360 .owner = THIS_MODULE,
362 .name = "nfs4", 361 .name = "nfs4",
363 .mount = nfs4_remote_mount, 362 .mount = nfs4_remote_mount,
364 .kill_sb = nfs4_kill_super, 363 .kill_sb = nfs_kill_super,
365 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, 364 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
366}; 365};
367 366
@@ -369,7 +368,7 @@ struct file_system_type nfs4_xdev_fs_type = {
369 .owner = THIS_MODULE, 368 .owner = THIS_MODULE,
370 .name = "nfs4", 369 .name = "nfs4",
371 .mount = nfs4_xdev_mount, 370 .mount = nfs4_xdev_mount,
372 .kill_sb = nfs4_kill_super, 371 .kill_sb = nfs_kill_super,
373 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, 372 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
374}; 373};
375 374
@@ -377,7 +376,7 @@ static struct file_system_type nfs4_remote_referral_fs_type = {
377 .owner = THIS_MODULE, 376 .owner = THIS_MODULE,
378 .name = "nfs4", 377 .name = "nfs4",
379 .mount = nfs4_remote_referral_mount, 378 .mount = nfs4_remote_referral_mount,
380 .kill_sb = nfs4_kill_super, 379 .kill_sb = nfs_kill_super,
381 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, 380 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
382}; 381};
383 382
@@ -385,7 +384,7 @@ struct file_system_type nfs4_referral_fs_type = {
385 .owner = THIS_MODULE, 384 .owner = THIS_MODULE,
386 .name = "nfs4", 385 .name = "nfs4",
387 .mount = nfs4_referral_mount, 386 .mount = nfs4_referral_mount,
388 .kill_sb = nfs4_kill_super, 387 .kill_sb = nfs_kill_super,
389 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, 388 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
390}; 389};
391 390
@@ -2874,18 +2873,6 @@ static struct dentry *nfs4_try_mount(int flags, const char *dev_name,
2874 return res; 2873 return res;
2875} 2874}
2876 2875
2877static void nfs4_kill_super(struct super_block *sb)
2878{
2879 struct nfs_server *server = NFS_SB(sb);
2880
2881 dprintk("--> %s\n", __func__);
2882 nfs_super_return_all_delegations(sb);
2883 kill_anon_super(sb);
2884 nfs_fscache_release_super_cookie(sb);
2885 nfs_free_server(server);
2886 dprintk("<-- %s\n", __func__);
2887}
2888
2889/* 2876/*
2890 * Clone an NFS4 server record on xdev traversal (FSID-change) 2877 * Clone an NFS4 server record on xdev traversal (FSID-change)
2891 */ 2878 */