Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 114312
b: refs/heads/master
c: c8ab5f2
h: refs/heads/master
v: v3
  • Loading branch information
J. Bruce Fields committed Sep 29, 2008
1 parent f6dc664 commit cff34f6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8fafa90082ab18859d97627fc454edf12f7efbff
refs/heads/master: c8ab5f2a13fb41a878863c61a1e27d78f1844b5e
24 changes: 13 additions & 11 deletions trunk/fs/lockd/svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,20 @@ unsigned long get_nfs_grace_period(void)
}
EXPORT_SYMBOL(get_nfs_grace_period);

static unsigned long set_grace_period(void)
static void grace_ender(struct work_struct *not_used)
{
nlmsvc_grace_period = 1;
return get_nfs_grace_period() + jiffies;
nlmsvc_grace_period = 0;
}

static inline void clear_grace_period(void)
static DECLARE_DELAYED_WORK(grace_period_end, grace_ender);

static void set_grace_period(void)
{
nlmsvc_grace_period = 0;
unsigned long grace_period = get_nfs_grace_period() + jiffies;

nlmsvc_grace_period = 1;
cancel_delayed_work_sync(&grace_period_end);
schedule_delayed_work(&grace_period_end, grace_period);
}

/*
Expand All @@ -116,7 +121,6 @@ lockd(void *vrqstp)
{
int err = 0, preverr = 0;
struct svc_rqst *rqstp = vrqstp;
unsigned long grace_period_expire;

/* try_to_freeze() is called from svc_recv() */
set_freezable();
Expand All @@ -139,7 +143,7 @@ lockd(void *vrqstp)
nlm_timeout = LOCKD_DFLT_TIMEO;
nlmsvc_timeout = nlm_timeout * HZ;

grace_period_expire = set_grace_period();
set_grace_period();

/*
* The main request loop. We don't terminate until the last
Expand All @@ -153,16 +157,13 @@ lockd(void *vrqstp)
flush_signals(current);
if (nlmsvc_ops) {
nlmsvc_invalidate_all();
grace_period_expire = set_grace_period();
set_grace_period();
}
continue;
}

timeout = nlmsvc_retry_blocked();

if (time_before(grace_period_expire, jiffies))
clear_grace_period();

/*
* Find a socket with data available and call its
* recvfrom routine.
Expand All @@ -189,6 +190,7 @@ lockd(void *vrqstp)
svc_process(rqstp);
}
flush_signals(current);
cancel_delayed_work_sync(&grace_period_end);
if (nlmsvc_ops)
nlmsvc_invalidate_all();
nlm_shutdown_hosts();
Expand Down

0 comments on commit cff34f6

Please sign in to comment.