Commit 8658452e authored by NeilBrown's avatar NeilBrown Committed by J. Bruce Fields

nfsd: Only set PF_LESS_THROTTLE when really needed.

PF_LESS_THROTTLE has a very specific use case: to avoid deadlocks
and live-locks while writing to the page cache in a loop-back
NFS mount situation.

It therefore makes sense to *only* set PF_LESS_THROTTLE in this
situation.
We now know when a request came from the local-host so it could be a
loop-back mount.  We already know when we are handling write requests,
and when we are doing anything else.

So combine those two to allow nfsd to still be throttled (like any
other process) in every situation except when it is known to be
problematic.
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent ef11ce24
...@@ -591,12 +591,6 @@ nfsd(void *vrqstp) ...@@ -591,12 +591,6 @@ nfsd(void *vrqstp)
nfsdstats.th_cnt++; nfsdstats.th_cnt++;
mutex_unlock(&nfsd_mutex); mutex_unlock(&nfsd_mutex);
/*
* We want less throttling in balance_dirty_pages() so that nfs to
* localhost doesn't cause nfsd to lock up due to all the client's
* dirty pages.
*/
current->flags |= PF_LESS_THROTTLE;
set_freezable(); set_freezable();
/* /*
......
...@@ -908,6 +908,16 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, ...@@ -908,6 +908,16 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
int stable = *stablep; int stable = *stablep;
int use_wgather; int use_wgather;
loff_t pos = offset; loff_t pos = offset;
unsigned int pflags = current->flags;
if (rqstp->rq_local)
/*
* We want less throttling in balance_dirty_pages()
* and shrink_inactive_list() so that nfs to
* localhost doesn't cause nfsd to lock up due to all
* the client's dirty pages or its congested queue.
*/
current->flags |= PF_LESS_THROTTLE;
dentry = file->f_path.dentry; dentry = file->f_path.dentry;
inode = dentry->d_inode; inode = dentry->d_inode;
...@@ -941,6 +951,8 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, ...@@ -941,6 +951,8 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
err = 0; err = 0;
else else
err = nfserrno(host_err); err = nfserrno(host_err);
if (rqstp->rq_local)
tsk_restore_flags(current, pflags, PF_LESS_THROTTLE);
return err; return err;
} }
......
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