NFSv4: keep state manager thread active if swap is enabled
[ Upstream commit 4dc73c679114a2f408567e2e44770ed934190db2 ] If we are swapping over NFSv4, we may not be able to allocate memory to start the state-manager thread at the time when we need it. So keep it always running when swap is enabled, and just signal it to start. This requires updating and testing the cl_swapper count on the root rpc_clnt after following all ->cl_parent links. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Stable-dep-of: b46d80bd2d6e ("nfs4trace: fix state manager flag printing") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
d601f78282
commit
6d434b4c49
@@ -487,8 +487,9 @@ static int nfs_swap_activate(struct swap_info_struct *sis, struct file *file,
|
||||
{
|
||||
unsigned long blocks;
|
||||
long long isize;
|
||||
struct rpc_clnt *clnt = NFS_CLIENT(file->f_mapping->host);
|
||||
struct inode *inode = file->f_mapping->host;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct rpc_clnt *clnt = NFS_CLIENT(inode);
|
||||
struct nfs_client *cl = NFS_SERVER(inode)->nfs_client;
|
||||
|
||||
spin_lock(&inode->i_lock);
|
||||
blocks = inode->i_blocks;
|
||||
@@ -501,14 +502,22 @@ static int nfs_swap_activate(struct swap_info_struct *sis, struct file *file,
|
||||
|
||||
*span = sis->pages;
|
||||
|
||||
|
||||
if (cl->rpc_ops->enable_swap)
|
||||
cl->rpc_ops->enable_swap(inode);
|
||||
|
||||
return rpc_clnt_swap_activate(clnt);
|
||||
}
|
||||
|
||||
static void nfs_swap_deactivate(struct file *file)
|
||||
{
|
||||
struct rpc_clnt *clnt = NFS_CLIENT(file->f_mapping->host);
|
||||
struct inode *inode = file_inode(file);
|
||||
struct rpc_clnt *clnt = NFS_CLIENT(inode);
|
||||
struct nfs_client *cl = NFS_SERVER(inode)->nfs_client;
|
||||
|
||||
rpc_clnt_swap_deactivate(clnt);
|
||||
if (cl->rpc_ops->disable_swap)
|
||||
cl->rpc_ops->disable_swap(file_inode(file));
|
||||
}
|
||||
|
||||
const struct address_space_operations nfs_file_aops = {
|
||||
|
Reference in New Issue
Block a user