Commit eeebf916 authored by Bryan Schumaker's avatar Bryan Schumaker Committed by Trond Myklebust

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: default avatarBryan Schumaker <bjschuma@netapp.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent e38eb650
...@@ -266,6 +266,8 @@ static void pnfs_init_server(struct nfs_server *server) ...@@ -266,6 +266,8 @@ static void pnfs_init_server(struct nfs_server *server)
static void nfs4_destroy_server(struct nfs_server *server) static void nfs4_destroy_server(struct nfs_server *server)
{ {
nfs_server_return_all_delegations(server);
unset_pnfs_layoutdriver(server);
nfs4_purge_state_owners(server); nfs4_purge_state_owners(server);
} }
...@@ -1137,7 +1139,6 @@ void nfs_free_server(struct nfs_server *server) ...@@ -1137,7 +1139,6 @@ void nfs_free_server(struct nfs_server *server)
dprintk("--> nfs_free_server()\n"); dprintk("--> nfs_free_server()\n");
nfs_server_remove_lists(server); nfs_server_remove_lists(server);
unset_pnfs_layoutdriver(server);
if (server->destroy != NULL) if (server->destroy != NULL)
server->destroy(server); server->destroy(server);
......
...@@ -417,9 +417,8 @@ static void nfs_mark_return_delegation(struct nfs_server *server, ...@@ -417,9 +417,8 @@ static void nfs_mark_return_delegation(struct nfs_server *server,
* @sb: sb to process * @sb: sb to process
* *
*/ */
void nfs_super_return_all_delegations(struct super_block *sb) void nfs_server_return_all_delegations(struct nfs_server *server)
{ {
struct nfs_server *server = NFS_SB(sb);
struct nfs_client *clp = server->nfs_client; struct nfs_client *clp = server->nfs_client;
struct nfs_delegation *delegation; struct nfs_delegation *delegation;
......
...@@ -38,7 +38,7 @@ int nfs_async_inode_return_delegation(struct inode *inode, const nfs4_stateid *s ...@@ -38,7 +38,7 @@ int nfs_async_inode_return_delegation(struct inode *inode, const nfs4_stateid *s
void nfs_inode_return_delegation_noreclaim(struct inode *inode); void nfs_inode_return_delegation_noreclaim(struct inode *inode);
struct inode *nfs_delegation_find_inode(struct nfs_client *clp, const struct nfs_fh *fhandle); struct inode *nfs_delegation_find_inode(struct nfs_client *clp, const struct nfs_fh *fhandle);
void nfs_super_return_all_delegations(struct super_block *sb); void nfs_server_return_all_delegations(struct nfs_server *);
void nfs_expire_all_delegations(struct nfs_client *clp); void nfs_expire_all_delegations(struct nfs_client *clp);
void nfs_expire_all_delegation_types(struct nfs_client *clp, fmode_t flags); void nfs_expire_all_delegation_types(struct nfs_client *clp, fmode_t flags);
void nfs_expire_unreferenced_delegations(struct nfs_client *clp); void nfs_expire_unreferenced_delegations(struct nfs_client *clp);
......
...@@ -347,13 +347,12 @@ static struct dentry *nfs4_referral_mount(struct file_system_type *fs_type, ...@@ -347,13 +347,12 @@ static struct dentry *nfs4_referral_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *raw_data); int flags, const char *dev_name, void *raw_data);
static struct dentry *nfs4_remote_referral_mount(struct file_system_type *fs_type, static struct dentry *nfs4_remote_referral_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *raw_data); int flags, const char *dev_name, void *raw_data);
static void nfs4_kill_super(struct super_block *sb);
static struct file_system_type nfs4_fs_type = { static struct file_system_type nfs4_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "nfs4", .name = "nfs4",
.mount = nfs_fs_mount, .mount = nfs_fs_mount,
.kill_sb = nfs4_kill_super, .kill_sb = nfs_kill_super,
.fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
}; };
...@@ -361,7 +360,7 @@ static struct file_system_type nfs4_remote_fs_type = { ...@@ -361,7 +360,7 @@ static struct file_system_type nfs4_remote_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "nfs4", .name = "nfs4",
.mount = nfs4_remote_mount, .mount = nfs4_remote_mount,
.kill_sb = nfs4_kill_super, .kill_sb = nfs_kill_super,
.fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
}; };
...@@ -369,7 +368,7 @@ struct file_system_type nfs4_xdev_fs_type = { ...@@ -369,7 +368,7 @@ struct file_system_type nfs4_xdev_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "nfs4", .name = "nfs4",
.mount = nfs4_xdev_mount, .mount = nfs4_xdev_mount,
.kill_sb = nfs4_kill_super, .kill_sb = nfs_kill_super,
.fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
}; };
...@@ -377,7 +376,7 @@ static struct file_system_type nfs4_remote_referral_fs_type = { ...@@ -377,7 +376,7 @@ static struct file_system_type nfs4_remote_referral_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "nfs4", .name = "nfs4",
.mount = nfs4_remote_referral_mount, .mount = nfs4_remote_referral_mount,
.kill_sb = nfs4_kill_super, .kill_sb = nfs_kill_super,
.fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
}; };
...@@ -385,7 +384,7 @@ struct file_system_type nfs4_referral_fs_type = { ...@@ -385,7 +384,7 @@ struct file_system_type nfs4_referral_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "nfs4", .name = "nfs4",
.mount = nfs4_referral_mount, .mount = nfs4_referral_mount,
.kill_sb = nfs4_kill_super, .kill_sb = nfs_kill_super,
.fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
}; };
...@@ -2874,18 +2873,6 @@ static struct dentry *nfs4_try_mount(int flags, const char *dev_name, ...@@ -2874,18 +2873,6 @@ static struct dentry *nfs4_try_mount(int flags, const char *dev_name,
return res; return res;
} }
static void nfs4_kill_super(struct super_block *sb)
{
struct nfs_server *server = NFS_SB(sb);
dprintk("--> %s\n", __func__);
nfs_super_return_all_delegations(sb);
kill_anon_super(sb);
nfs_fscache_release_super_cookie(sb);
nfs_free_server(server);
dprintk("<-- %s\n", __func__);
}
/* /*
* Clone an NFS4 server record on xdev traversal (FSID-change) * Clone an NFS4 server record on xdev traversal (FSID-change)
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment