Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
grace.c
Go to the documentation of this file.
1 /*
2  * Common code for control of lockd and nfsv4 grace periods.
3  */
4 
5 #include <linux/module.h>
6 #include <linux/lockd/bind.h>
7 #include <net/net_namespace.h>
8 
9 #include "netns.h"
10 
11 static DEFINE_SPINLOCK(grace_lock);
12 
24 void locks_start_grace(struct net *net, struct lock_manager *lm)
25 {
26  struct lockd_net *ln = net_generic(net, lockd_net_id);
27 
28  spin_lock(&grace_lock);
29  list_add(&lm->list, &ln->grace_list);
30  spin_unlock(&grace_lock);
31 }
33 
45 {
46  spin_lock(&grace_lock);
47  list_del_init(&lm->list);
48  spin_unlock(&grace_lock);
49 }
51 
59 int locks_in_grace(struct net *net)
60 {
61  struct lockd_net *ln = net_generic(net, lockd_net_id);
62 
63  return !list_empty(&ln->grace_list);
64 }