diff options
-rw-r--r-- | fs/lockd/svc.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index bdc607bb25e9..f345ef7fb8ae 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c | |||
@@ -97,15 +97,20 @@ unsigned long get_nfs_grace_period(void) | |||
97 | } | 97 | } |
98 | EXPORT_SYMBOL(get_nfs_grace_period); | 98 | EXPORT_SYMBOL(get_nfs_grace_period); |
99 | 99 | ||
100 | static unsigned long set_grace_period(void) | 100 | static void grace_ender(struct work_struct *not_used) |
101 | { | 101 | { |
102 | nlmsvc_grace_period = 1; | 102 | nlmsvc_grace_period = 0; |
103 | return get_nfs_grace_period() + jiffies; | ||
104 | } | 103 | } |
105 | 104 | ||
106 | static inline void clear_grace_period(void) | 105 | static DECLARE_DELAYED_WORK(grace_period_end, grace_ender); |
106 | |||
107 | static void set_grace_period(void) | ||
107 | { | 108 | { |
108 | nlmsvc_grace_period = 0; | 109 | unsigned long grace_period = get_nfs_grace_period() + jiffies; |
110 | |||
111 | nlmsvc_grace_period = 1; | ||
112 | cancel_delayed_work_sync(&grace_period_end); | ||
113 | schedule_delayed_work(&grace_period_end, grace_period); | ||
109 | } | 114 | } |
110 | 115 | ||
111 | /* | 116 | /* |
@@ -116,7 +121,6 @@ lockd(void *vrqstp) | |||
116 | { | 121 | { |
117 | int err = 0, preverr = 0; | 122 | int err = 0, preverr = 0; |
118 | struct svc_rqst *rqstp = vrqstp; | 123 | struct svc_rqst *rqstp = vrqstp; |
119 | unsigned long grace_period_expire; | ||
120 | 124 | ||
121 | /* try_to_freeze() is called from svc_recv() */ | 125 | /* try_to_freeze() is called from svc_recv() */ |
122 | set_freezable(); | 126 | set_freezable(); |
@@ -139,7 +143,7 @@ lockd(void *vrqstp) | |||
139 | nlm_timeout = LOCKD_DFLT_TIMEO; | 143 | nlm_timeout = LOCKD_DFLT_TIMEO; |
140 | nlmsvc_timeout = nlm_timeout * HZ; | 144 | nlmsvc_timeout = nlm_timeout * HZ; |
141 | 145 | ||
142 | grace_period_expire = set_grace_period(); | 146 | set_grace_period(); |
143 | 147 | ||
144 | /* | 148 | /* |
145 | * The main request loop. We don't terminate until the last | 149 | * The main request loop. We don't terminate until the last |
@@ -153,16 +157,13 @@ lockd(void *vrqstp) | |||
153 | flush_signals(current); | 157 | flush_signals(current); |
154 | if (nlmsvc_ops) { | 158 | if (nlmsvc_ops) { |
155 | nlmsvc_invalidate_all(); | 159 | nlmsvc_invalidate_all(); |
156 | grace_period_expire = set_grace_period(); | 160 | set_grace_period(); |
157 | } | 161 | } |
158 | continue; | 162 | continue; |
159 | } | 163 | } |
160 | 164 | ||
161 | timeout = nlmsvc_retry_blocked(); | 165 | timeout = nlmsvc_retry_blocked(); |
162 | 166 | ||
163 | if (time_before(grace_period_expire, jiffies)) | ||
164 | clear_grace_period(); | ||
165 | |||
166 | /* | 167 | /* |
167 | * Find a socket with data available and call its | 168 | * Find a socket with data available and call its |
168 | * recvfrom routine. | 169 | * recvfrom routine. |
@@ -189,6 +190,7 @@ lockd(void *vrqstp) | |||
189 | svc_process(rqstp); | 190 | svc_process(rqstp); |
190 | } | 191 | } |
191 | flush_signals(current); | 192 | flush_signals(current); |
193 | cancel_delayed_work_sync(&grace_period_end); | ||
192 | if (nlmsvc_ops) | 194 | if (nlmsvc_ops) |
193 | nlmsvc_invalidate_all(); | 195 | nlmsvc_invalidate_all(); |
194 | nlm_shutdown_hosts(); | 196 | nlm_shutdown_hosts(); |