diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2012-11-14 10:22:17 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2012-11-15 07:40:51 -0500 |
commit | 0912128149e86b48ed946371298d7fe61120d627 (patch) | |
tree | 479c8ccf93cfccd720d40be8b47745690cef6ff6 /fs/nfsd/nfs4state.c | |
parent | 12760c6685624d65f8de078485c21b6a08e83409 (diff) |
nfsd: make laundromat network namespace aware
This patch moves laundromat_work to nfsd per-net context, thus allowing to run
multiple laundries.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r-- | fs/nfsd/nfs4state.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 2e4ed691255a..e75872f81e1c 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -3176,7 +3176,7 @@ nfsd4_end_grace(struct nfsd_net *nn) | |||
3176 | } | 3176 | } |
3177 | 3177 | ||
3178 | static time_t | 3178 | static time_t |
3179 | nfs4_laundromat(void) | 3179 | nfs4_laundromat(struct nfsd_net *nn) |
3180 | { | 3180 | { |
3181 | struct nfs4_client *clp; | 3181 | struct nfs4_client *clp; |
3182 | struct nfs4_openowner *oo; | 3182 | struct nfs4_openowner *oo; |
@@ -3185,7 +3185,6 @@ nfs4_laundromat(void) | |||
3185 | time_t cutoff = get_seconds() - nfsd4_lease; | 3185 | time_t cutoff = get_seconds() - nfsd4_lease; |
3186 | time_t t, clientid_val = nfsd4_lease; | 3186 | time_t t, clientid_val = nfsd4_lease; |
3187 | time_t u, test_val = nfsd4_lease; | 3187 | time_t u, test_val = nfsd4_lease; |
3188 | struct nfsd_net *nn = net_generic(&init_net, nfsd_net_id); | ||
3189 | 3188 | ||
3190 | nfs4_lock_state(); | 3189 | nfs4_lock_state(); |
3191 | 3190 | ||
@@ -3251,16 +3250,19 @@ nfs4_laundromat(void) | |||
3251 | 3250 | ||
3252 | static struct workqueue_struct *laundry_wq; | 3251 | static struct workqueue_struct *laundry_wq; |
3253 | static void laundromat_main(struct work_struct *); | 3252 | static void laundromat_main(struct work_struct *); |
3254 | static DECLARE_DELAYED_WORK(laundromat_work, laundromat_main); | ||
3255 | 3253 | ||
3256 | static void | 3254 | static void |
3257 | laundromat_main(struct work_struct *not_used) | 3255 | laundromat_main(struct work_struct *laundry) |
3258 | { | 3256 | { |
3259 | time_t t; | 3257 | time_t t; |
3258 | struct delayed_work *dwork = container_of(laundry, struct delayed_work, | ||
3259 | work); | ||
3260 | struct nfsd_net *nn = container_of(dwork, struct nfsd_net, | ||
3261 | laundromat_work); | ||
3260 | 3262 | ||
3261 | t = nfs4_laundromat(); | 3263 | t = nfs4_laundromat(nn); |
3262 | dprintk("NFSD: laundromat_main - sleeping for %ld seconds\n", t); | 3264 | dprintk("NFSD: laundromat_main - sleeping for %ld seconds\n", t); |
3263 | queue_delayed_work(laundry_wq, &laundromat_work, t*HZ); | 3265 | queue_delayed_work(laundry_wq, &nn->laundromat_work, t*HZ); |
3264 | } | 3266 | } |
3265 | 3267 | ||
3266 | static inline __be32 nfs4_check_fh(struct svc_fh *fhp, struct nfs4_ol_stateid *stp) | 3268 | static inline __be32 nfs4_check_fh(struct svc_fh *fhp, struct nfs4_ol_stateid *stp) |
@@ -4791,6 +4793,8 @@ static int nfs4_state_start_net(struct net *net) | |||
4791 | INIT_LIST_HEAD(&nn->client_lru); | 4793 | INIT_LIST_HEAD(&nn->client_lru); |
4792 | INIT_LIST_HEAD(&nn->close_lru); | 4794 | INIT_LIST_HEAD(&nn->close_lru); |
4793 | 4795 | ||
4796 | INIT_DELAYED_WORK(&nn->laundromat_work, laundromat_main); | ||
4797 | |||
4794 | return 0; | 4798 | return 0; |
4795 | 4799 | ||
4796 | err_sessionid: | 4800 | err_sessionid: |
@@ -4875,7 +4879,8 @@ nfs4_state_start(void) | |||
4875 | ret = nfsd4_create_callback_queue(); | 4879 | ret = nfsd4_create_callback_queue(); |
4876 | if (ret) | 4880 | if (ret) |
4877 | goto out_free_laundry; | 4881 | goto out_free_laundry; |
4878 | queue_delayed_work(laundry_wq, &laundromat_work, nfsd4_grace * HZ); | 4882 | |
4883 | queue_delayed_work(laundry_wq, &nn->laundromat_work, nfsd4_grace * HZ); | ||
4879 | set_max_delegations(); | 4884 | set_max_delegations(); |
4880 | return 0; | 4885 | return 0; |
4881 | out_free_laundry: | 4886 | out_free_laundry: |
@@ -4918,7 +4923,7 @@ nfs4_state_shutdown(void) | |||
4918 | struct net *net = &init_net; | 4923 | struct net *net = &init_net; |
4919 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); | 4924 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); |
4920 | 4925 | ||
4921 | cancel_delayed_work_sync(&laundromat_work); | 4926 | cancel_delayed_work_sync(&nn->laundromat_work); |
4922 | destroy_workqueue(laundry_wq); | 4927 | destroy_workqueue(laundry_wq); |
4923 | locks_end_grace(&nn->nfsd4_manager); | 4928 | locks_end_grace(&nn->nfsd4_manager); |
4924 | nfs4_lock_state(); | 4929 | nfs4_lock_state(); |