Skip to content

Commit

Permalink
[PATCH] knfsd: nfsd4: create separate laundromat workqueue
Browse files Browse the repository at this point in the history
We're running the laundromat work on the default kevent worker thread.  But
the laundromat takes the nfsv4 state semaphore, which is used for way too much
stuff, and the potential for deadlocks is high.  Better to have this on a
separate workqueue.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
NeilBrown authored and Linus Torvalds committed Jun 24, 2005
1 parent dfc8356 commit 58da282
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -1844,6 +1844,7 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
return status;
}

static struct workqueue_struct *laundry_wq;
static struct work_struct laundromat_work;
static void laundromat_main(void *);
static DECLARE_WORK(laundromat_work, laundromat_main, NULL);
Expand Down Expand Up @@ -1951,7 +1952,7 @@ laundromat_main(void *not_used)

t = nfs4_laundromat();
dprintk("NFSD: laundromat_main - sleeping for %ld seconds\n", t);
schedule_delayed_work(&laundromat_work, t*HZ);
queue_delayed_work(laundry_wq, &laundromat_work, t*HZ);
}

/* search ownerid_hashtbl[] and close_lru for stateid owner
Expand Down Expand Up @@ -3211,7 +3212,8 @@ __nfs4_state_init(void)
printk("NFSD: starting %ld-second grace period\n", grace_time);
grace_end = boot_time + grace_time;
INIT_WORK(&laundromat_work,laundromat_main, NULL);
schedule_delayed_work(&laundromat_work, NFSD_LEASE_TIME*HZ);
laundry_wq = create_singlethread_workqueue("nfsd4");
queue_delayed_work(laundry_wq, &laundromat_work, NFSD_LEASE_TIME*HZ);
}

int
Expand Down Expand Up @@ -3287,7 +3289,8 @@ __nfs4_state_shutdown(void)
}

cancel_delayed_work(&laundromat_work);
flush_scheduled_work();
flush_workqueue(laundry_wq);
destroy_workqueue(laundry_wq);
nfs4_init = 0;
}

Expand Down

0 comments on commit 58da282

Please sign in to comment.