aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-04-10 11:08:48 -0400
committerJ. Bruce Fields <bfields@redhat.com>2012-04-11 17:55:00 -0400
commit33dcc481eddc3f532732a9582095373fa5354369 (patch)
tree33aaf10432675f5e8ab3b83a6d970d4a83cb21f0 /fs
parenta9aa53df6e6c768fc0f25a7c80ba586b0290720a (diff)
nfsd: don't use locks_in_grace to determine whether to call nfs4_grace_end
It's possible that lockd or another lock manager might still be on the list after we call nfsd4_end_grace. If the laundromat thread runs again at that point, then we could end up calling nfsd4_end_grace more than once. That's not only inefficient, but calling nfsd4_recdir_purge_old more than once could be problematic. Fix this by adding a new global "grace_ended" flag and use that to determine whether we've already called nfsd4_grace_end. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfs4state.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index a822e31de4f8..277c989e7f7b 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3155,10 +3155,17 @@ out:
3155static struct lock_manager nfsd4_manager = { 3155static struct lock_manager nfsd4_manager = {
3156}; 3156};
3157 3157
3158static bool grace_ended;
3159
3158static void 3160static void
3159nfsd4_end_grace(void) 3161nfsd4_end_grace(void)
3160{ 3162{
3163 /* do nothing if grace period already ended */
3164 if (grace_ended)
3165 return;
3166
3161 dprintk("NFSD: end of grace period\n"); 3167 dprintk("NFSD: end of grace period\n");
3168 grace_ended = true;
3162 nfsd4_record_grace_done(&init_net, boot_time); 3169 nfsd4_record_grace_done(&init_net, boot_time);
3163 locks_end_grace(&nfsd4_manager); 3170 locks_end_grace(&nfsd4_manager);
3164 /* 3171 /*
@@ -3183,8 +3190,7 @@ nfs4_laundromat(void)
3183 nfs4_lock_state(); 3190 nfs4_lock_state();
3184 3191
3185 dprintk("NFSD: laundromat service - starting\n"); 3192 dprintk("NFSD: laundromat service - starting\n");
3186 if (locks_in_grace()) 3193 nfsd4_end_grace();
3187 nfsd4_end_grace();
3188 INIT_LIST_HEAD(&reaplist); 3194 INIT_LIST_HEAD(&reaplist);
3189 spin_lock(&client_lock); 3195 spin_lock(&client_lock);
3190 list_for_each_safe(pos, next, &client_lru) { 3196 list_for_each_safe(pos, next, &client_lru) {
@@ -4718,6 +4724,7 @@ nfs4_state_start(void)
4718 nfsd4_client_tracking_init(&init_net); 4724 nfsd4_client_tracking_init(&init_net);
4719 boot_time = get_seconds(); 4725 boot_time = get_seconds();
4720 locks_start_grace(&nfsd4_manager); 4726 locks_start_grace(&nfsd4_manager);
4727 grace_ended = false;
4721 printk(KERN_INFO "NFSD: starting %ld-second grace period\n", 4728 printk(KERN_INFO "NFSD: starting %ld-second grace period\n",
4722 nfsd4_grace); 4729 nfsd4_grace);
4723 ret = set_callback_cred(); 4730 ret = set_callback_cred();