aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2014-05-11 21:22:47 -0400
committerJ. Bruce Fields <bfields@redhat.com>2014-05-22 15:59:19 -0400
commit8658452e4a588da603f6cb5ee2615deafcd82b71 (patch)
tree5f2bdfa67fa8eb23d24958f541a1b8698185bc0b /fs
parentef11ce24875a8a540adc185e7bce3d7d49c8296f (diff)
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: NeilBrown <neilb@suse.de> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfssvc.c6
-rw-r--r--fs/nfsd/vfs.c12
2 files changed, 12 insertions, 6 deletions
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 9a4a5f9e7468..1879e43f2868 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -591,12 +591,6 @@ nfsd(void *vrqstp)
591 nfsdstats.th_cnt++; 591 nfsdstats.th_cnt++;
592 mutex_unlock(&nfsd_mutex); 592 mutex_unlock(&nfsd_mutex);
593 593
594 /*
595 * We want less throttling in balance_dirty_pages() so that nfs to
596 * localhost doesn't cause nfsd to lock up due to all the client's
597 * dirty pages.
598 */
599 current->flags |= PF_LESS_THROTTLE;
600 set_freezable(); 594 set_freezable();
601 595
602 /* 596 /*
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 6aaa3057683a..3aa38523b6d7 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -908,6 +908,16 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
908 int stable = *stablep; 908 int stable = *stablep;
909 int use_wgather; 909 int use_wgather;
910 loff_t pos = offset; 910 loff_t pos = offset;
911 unsigned int pflags = current->flags;
912
913 if (rqstp->rq_local)
914 /*
915 * We want less throttling in balance_dirty_pages()
916 * and shrink_inactive_list() so that nfs to
917 * localhost doesn't cause nfsd to lock up due to all
918 * the client's dirty pages or its congested queue.
919 */
920 current->flags |= PF_LESS_THROTTLE;
911 921
912 dentry = file->f_path.dentry; 922 dentry = file->f_path.dentry;
913 inode = dentry->d_inode; 923 inode = dentry->d_inode;
@@ -941,6 +951,8 @@ out_nfserr:
941 err = 0; 951 err = 0;
942 else 952 else
943 err = nfserrno(host_err); 953 err = nfserrno(host_err);
954 if (rqstp->rq_local)
955 tsk_restore_flags(current, pflags, PF_LESS_THROTTLE);
944 return err; 956 return err;
945} 957}
946 958