Skip to contentSkip to conversation

Problems with locking, permanent 'lockd: server in grace period'

DISCUSSION Malcolm Locke 2 participants 4 messages Aug 8, 2011 – Aug 26, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi,

First off, apologies for bringing such mundane matters to the list, but we're at the end of our tethers and way out of our depth on this. We have a problem on our production machine that we are unable to replicate on a test machine, and would greatly appreciate any pointers of where to look next.

We're in the process of upgrading a DRBD pair running Ubuntu hardy to Debian squeeze. The first of the pair has been upgraded, and NFS works correctly except for locking. Calls to flock() from any client on an NFS mount hang indefinitely.

We've installed a fresh Debian squeeze machine to test, but are completely unable to reproduce the issue. Pertinent details about the set up:

Kernel on both machines:
Linux debian 2.6.32-5-openvz-amd64 #1 SMP Tue Jun 14 10:46:15 UTC 2011 x86_64 GNU/Linux

Debian package versions:
nfs-common 1.2.2-4
nfs-kernel-server 1.2.2-4
rpcbind 0.2.0-4.1

Filesystem is ext3 rw,relatime,errors=remount-ro,data=ordered /etc/exports has rw,no_root_squash,async,no_subtree_check

On both the working and failing hosts, the NFS is mounted with default options, e.g. mount host:/home /mnt

Below is the nlm debug from the working host (hostname debian on the left) and the failing host (itchy on the right). Apologies for the wide text, I've aligned the log messages from a single flock() attempt so the corresponding lines match up for each host. In both cases, the NFS client and server are the same host.

Points I note from this are:

- xdr_dec_stat_res doesn't get called on the failing host
- nlm_lookup_host reports 'found host' on the failing host, and 'created host' on the working host.
- vfs_lock_file returned 0 doesn't log on the failing host. I think this is because one of the following checks is returning true:

    // fs/lockd/svclock.c:411
    if (locks_in_grace() && !reclaim) {
            ret = nlm_lck_denied_grace_period;
            goto out;
    }
    if (reclaim && !locks_in_grace()) {
            ret = nlm_lck_denied_grace_period;
            goto out;
    }

I've come to this conclusion because of the 'lockd: server in grace period'. The failing host has been up for several days, and on both machines /proc/sys/fs/nfs/nlm_grace_period is 0.

Any help on this would be greatly appreciated, including where to go next. If you require any more info let me know. Thanks for your time.

Malc

[574991.066444] lockd: get host 192.168.200.187	                                                                    [293744.611248] lockd: get host itchy
[574991.066452] lockd: get host 192.168.200.187	                                                                    [293744.611253] lockd: get host itchy
[574991.066459] lockd: nsm_monitor(192.168.200.187)	                                                                [293744.611258] lockd: nsm_monitor(itchy)
[574991.069694] lockd: xdr_dec_stat_res status 0 state 5	
[574991.069704] lockd: call procedure 2 on 192.168.200.187	                                                        [293744.611262] lockd: call procedure 2 on itchy
[574991.069707] lockd: nlm_bind_host 192.168.200.187 (192.168.200.187)	                                            [293744.611264] lockd: nlm_bind_host itchy (172.16.95.10)
[574991.069950] lockd: request from 192.168.200.187, port=897	                                                      [293744.611305] lockd: request from 172.16.95.10, port=755
[574991.069957] lockd: LOCK          called	                                                                        [293744.611313] lockd: LOCK          called
[574991.069959] lockd: nlmsvc_lookup_host(host='debian', vers=4, proto=tcp)	                                        [293744.611316] lockd: nlmsvc_lookup_host(host='itchy', vers=4, proto=tcp)
	                                                                                                                  [293744.611321] lockd: get host itchy
[574991.069963] lockd: nlm_lookup_host created host 192.168.200.187	                                                [293744.611323] lockd: nlm_lookup_host found host itchy (172.16.95.10)
[574991.069965] lockd: nsm_monitor(192.168.200.187)	                                                                [293744.611326] lockd: nsm_monitor(itchy)
[574991.069968] lockd: nlm_lookup_file (01070001 00029c11 00000000 4d467ad5 49423ea4 e25c57a1 19207193 00029c23)	  [293744.611330] lockd: nlm_lookup_file (01070001 0003da31 00000000 97fe8af7 994c3d1e 44abb885 3e24dab0 0003da5b)
[574991.069973] lockd: creating file for (01070001 00029c11 00000000 4d467ad5 49423ea4 e25c57a1 19207193 00029c23)	[293744.611335] lockd: creating file for (01070001 0003da31 00000000 97fe8af7 994c3d1e 44abb885 3e24dab0 0003da5b)
[574991.069985] lockd: found file ffff880122c87800 (count 0)	                                                      [293744.611347] lockd: found file ffff880429d90400 (count 0)
[574991.069989] lockd: nlmsvc_lock(sda2/171043, ty=1, pi=0, 0-9223372036854775807, bl=1)	                          [293744.611351] lockd: nlmsvc_lock(md0/252507, ty=1, pi=7, 0-9223372036854775807, bl=1)
[574991.069993] lockd: nlmsvc_lookup_block f=ffff880122c87800 pd=0 0-9223372036854775807 ty=1	                      [293744.611355] lockd: nlmsvc_lookup_block f=ffff880429d90400 pd=7 0-9223372036854775807 ty=1
[574991.069996] lockd: get host 192.168.200.187	                                                                    [293744.611359] lockd: get host itchy
[574991.069999] lockd: created block ffff8801249a8200...	                                                          [293744.611363] lockd: created block ffff8803fa388b00...
[574991.070003] lockd: vfs_lock_file returned 0	
[574991.070005] lockd: freeing block ffff8801249a8200...	                                                          [293744.611366] lockd: freeing block ffff8803fa388b00...
[574991.070007] lockd: release host 192.168.200.187	                                                                [293744.611369] lockd: release host itchy
[574991.070009] lockd: nlm_release_file(ffff880122c87800, ct = 2)	                                                  [293744.611372] lockd: nlm_release_file(ffff880429d90400, ct = 2)
[574991.070011] lockd: nlmsvc_lock returned 0	                                                                      [293744.611375] lockd: nlmsvc_lock returned 67108864
[574991.070013] lockd: LOCK         status 0	                                                                      [293744.611377] lockd: LOCK         status 4
[574991.070014] lockd: release host 192.168.200.187	                                                                [293744.611379] lockd: release host itchy
[574991.070016] lockd: nlm_release_file(ffff880122c87800, ct = 1)	                                                  [293744.611381] lockd: nlm_release_file(ffff880429d90400, ct = 1)
[574991.070063] lockd: server returns status 0	
[574991.070072] lockd: release host 192.168.200.187	
[574991.070077] lockd: clnt proc returns 0	
[574991.070917] lockd: get host 192.168.200.187	
[574991.070920] lockd: get host 192.168.200.187	
[574991.070923] lockd: release host 192.168.200.187	
[574991.070925] lockd: release host 192.168.200.187	
[574991.070927] lockd: clnt proc returns 0	
[574991.070975] lockd: get host 192.168.200.187	
[574991.070978] lockd: get host 192.168.200.187	
[574991.070980] lockd: release host 192.168.200.187	
[574991.070982] lockd: release host 192.168.200.187	
[574991.070983] lockd: clnt proc returns 0	
[574991.070985] lockd: get host 192.168.200.187	
[574991.070988] lockd: call procedure 4 on 192.168.200.187 (async)	
[574991.070990] lockd: nlm_bind_host 192.168.200.187 (192.168.200.187)	
[574991.071014] lockd: request from 192.168.200.187, port=897	
[574991.071018] lockd: UNLOCK        called	
[574991.071020] lockd: nlmsvc_lookup_host(host='debian', vers=4, proto=tcp)	
[574991.071023] lockd: get host 192.168.200.187	
[574991.071024] lockd: nlm_lookup_host found host 192.168.200.187 (192.168.200.187)	
[574991.071028] lockd: nlm_lookup_file (01070001 00029c11 00000000 4d467ad5 49423ea4 e25c57a1 19207193 00029c23)	
[574991.071031] lockd: found file ffff880122c87800 (count 0)	
[574991.071034] lockd: nlmsvc_unlock(sda2/171043, pi=0, 0-9223372036854775807)	
[574991.071037] lockd: nlmsvc_cancel(sda2/171043, pi=0, 0-9223372036854775807)	
[574991.071040] lockd: nlmsvc_lookup_block f=ffff880122c87800 pd=0 0-9223372036854775807 ty=2	
[574991.071043] lockd: UNLOCK        status 0	
[574991.071045] lockd: release host 192.168.200.187	
[574991.071047] lockd: nlm_release_file(ffff880122c87800, ct = 1)	
[574991.071049] lockd: closing file sda2/171043	                                                                    [293744.611384] lockd: closing file md0/252507
[574991.071074] lockd: release host 192.168.200.187	                                                                [293744.611419] lockd: server in grace period
[574991.071076] lockd: release host 192.168.200.187	
[574991.071078] lockd: clnt proc returns 0	
[574991.117705] lockd: release host 192.168.200.187	
#1 lore raw
Quoted 54 lines · Malcolm Locke

First off, apologies for bringing such mundane matters to the list, but we're at the end of our tethers and way out of our depth on this. We have a problem on our production machine that we are unable to replicate on a test machine, and would greatly appreciate any pointers of where to look next.

We're in the process of upgrading a DRBD pair running Ubuntu hardy to Debian squeeze. The first of the pair has been upgraded, and NFS works correctly except for locking. Calls to flock() from any client on an NFS mount hang indefinitely.

We've installed a fresh Debian squeeze machine to test, but are completely unable to reproduce the issue. Pertinent details about the set up:

Kernel on both machines:
Linux debian 2.6.32-5-openvz-amd64 #1 SMP Tue Jun 14 10:46:15 UTC 2011 x86_64 GNU/Linux

Debian package versions:
nfs-common 1.2.2-4
nfs-kernel-server 1.2.2-4
rpcbind 0.2.0-4.1

Filesystem is ext3 rw,relatime,errors=remount-ro,data=ordered /etc/exports has rw,no_root_squash,async,no_subtree_check

On both the working and failing hosts, the NFS is mounted with default options, e.g. mount host:/home /mnt

Below is the nlm debug from the working host (hostname debian on the left) and the failing host (itchy on the right). Apologies for the wide text, I've aligned the log messages from a single flock() attempt so the corresponding lines match up for each host. In both cases, the NFS client and server are the same host.

Points I note from this are:

- xdr_dec_stat_res doesn't get called on the failing host
- nlm_lookup_host reports 'found host' on the failing host, and 'created host' on the working host.
- vfs_lock_file returned 0 doesn't log on the failing host. I think this is because one of the following checks is returning true:

    // fs/lockd/svclock.c:411
    if (locks_in_grace() && !reclaim) {
            ret = nlm_lck_denied_grace_period;
            goto out;
    }
    if (reclaim && !locks_in_grace()) {
            ret = nlm_lck_denied_grace_period;
            goto out;
    }
Quoted 6 lines

I've come to this conclusion because of the 'lockd: server in grace period'. The failing host has been up for several days, and on both machines /proc/sys/fs/nfs/nlm_grace_period is 0.

Any help on this would be greatly appreciated, including where to go next. If you require any more info let me know. Thanks for your time.

It might be worth trying this in addition to the recoverydir fixes previously posted.

--b.

commit c52560f10794b9fb8c050532d27ff999d8f5c23c

Author: J. Bruce Fields <[email protected]>
Date:   Fri Aug 12 11:59:44 2011 -0400

some grace period fixes and debugging

fs/lockd/grace.c +12 -1
index 183cc1f..61272f7 100644
@@ -22,6 +22,7 @@ static DEFINE_SPINLOCK(grace_lock);
 void locks_start_grace(struct lock_manager *lm)
 {
 	spin_lock(&grace_lock);
+	printk("lm->name starting grace period\n");
 	list_add(&lm->list, &grace_list);
 	spin_unlock(&grace_lock);
 }
@@ -40,6 +41,7 @@ EXPORT_SYMBOL_GPL(locks_start_grace);
 void locks_end_grace(struct lock_manager *lm)
 {
 	spin_lock(&grace_lock);
+	printk("%s ending grace period\n", lm->name);
 	list_del_init(&lm->list);
 	spin_unlock(&grace_lock);
 }
@@ -54,6 +56,15 @@ EXPORT_SYMBOL_GPL(locks_end_grace);
  */
 int locks_in_grace(void)
 {
-	return !list_empty(&grace_list);
+	if (!list_empty(&grace_list)) {
+		struct lock_manager *lm;
+
+		printk("in grace period due to: ");
+		list_for_each_entry(lm, &grace_list, list)
+			printk("%s ",lm->name);
+		printk("\n");
+		return 1;
+	}
+	return 0;
 }
 EXPORT_SYMBOL_GPL(locks_in_grace);
fs/lockd/svc.c +2 -1
index c061b9a..1638929 100644
@@ -84,6 +84,7 @@ static unsigned long get_lockd_grace_period(void)
 }
 
 static struct lock_manager lockd_manager = {
+	.name = "lockd"
 };
 
 static void grace_ender(struct work_struct *not_used)
@@ -97,8 +98,8 @@ static void set_grace_period(void)
 {
 	unsigned long grace_period = get_lockd_grace_period();
 
-	locks_start_grace(&lockd_manager);
 	cancel_delayed_work_sync(&grace_period_end);
+	locks_start_grace(&lockd_manager);
 	schedule_delayed_work(&grace_period_end, grace_period);
 }
 
fs/nfsd/nfs4state.c +2 -1
index 3787ec1..b83ffdf 100644
@@ -2942,6 +2942,7 @@ out:
 }
 
 static struct lock_manager nfsd4_manager = {
+	.name = "nfsd4",
 };
 
 static void
@@ -4563,7 +4564,6 @@ __nfs4_state_start(void)
 	int ret;
 
 	boot_time = get_seconds();
-	locks_start_grace(&nfsd4_manager);
 	printk(KERN_INFO "NFSD: starting %ld-second grace period\n",
 	       nfsd4_grace);
 	ret = set_callback_cred();
@@ -4575,6 +4575,7 @@ __nfs4_state_start(void)
 	ret = nfsd4_create_callback_queue();
 	if (ret)
 		goto out_free_laundry;
+	locks_start_grace(&nfsd4_manager);
 	queue_delayed_work(laundry_wq, &laundromat_work, nfsd4_grace * HZ);
 	set_max_delegations();
 	return 0;
include/linux/fs.h +1 -0
index ad35091..9501aa7 100644
@@ -1098,6 +1098,7 @@ struct lock_manager_operations {
 };
 
 struct lock_manager {
+	char *name;
 	struct list_head list;
 };
 
#2 lore raw
Quoted 7 lines · J. Bruce Fields
Quoted 6 lines · Malcolm Locke

First off, apologies for bringing such mundane matters to the list, but we're at the end of our tethers and way out of our depth on this. We have a problem on our production machine that we are unable to replicate on a test machine, and would greatly appreciate any pointers of where to look next.

Quoted 7 lines
Quoted 7 lines

We're in the process of upgrading a DRBD pair running Ubuntu hardy to Debian squeeze. The first of the pair has been upgraded, and NFS works correctly except for locking. Calls to flock() from any client on an NFS mount hang indefinitely.

We've installed a fresh Debian squeeze machine to test, but are completely unable to reproduce the issue.

OK, I've finally managed to reproduce this on our test machine. Given the package list below:

Quoted 11 lines
Quoted 11 lines

Pertinent details about the
set up:

Kernel on both machines:
Linux debian 2.6.32-5-openvz-amd64 #1 SMP Tue Jun 14 10:46:15 UTC 2011 x86_64 GNU/Linux

Debian package versions:
nfs-common 1.2.2-4
nfs-kernel-server 1.2.2-4
rpcbind 0.2.0-4.1

And the following /etc/exports:

  /home        192.168.200.0/24(rw,no_root_squash,async,no_subtree_check)
  /nfs4        192.168.200.0/24(rw,sync,fsid=0,crossmnt)
  /nfs4/flum   192.168.200.0/24(rw,sync)

After a fresh boot:

# Just mount and unmount a v4 mount (192.168.200.187 == localhost)

  $ mount -t nfs4 192.168.200.187:/flum /mnt
  $ umount /mnt
  $ /etc/init.d/nfs-kernel-server stop
  # Comment out the v4 entries from /etc/exports, so only /home remains,
  # and restart the server so v4 is disabled.
  $ /etc/init.d/nfs-kernel-server start

# Mount with v3

  $ mount 192.168.200.187:/home /mnt

# Now trying to flock() will fail, with server staying in grace period

  # ad infinitum
  $ flock /mnt/foo ls

I'm not sure if this is the exact sequence of events we had to get things stuck on our production machine (it's possible), but this sequence will always get the server into indefinite grace period for me.

Quoted 3 lines

It might be worth trying this in addition to the recoverydir fixes previously posted.

Thanks, I haven't had the opportunity to try this yet but will do so on the test machine and report back if I get time.

Quoted 105 lines

commit c52560f10794b9fb8c050532d27ff999d8f5c23c

Author: J. Bruce Fields <[email protected]>
Date:   Fri Aug 12 11:59:44 2011 -0400

some grace period fixes and debugging

fs/lockd/grace.c +12 -1
index 183cc1f..61272f7 100644
@@ -22,6 +22,7 @@ static DEFINE_SPINLOCK(grace_lock);
 void locks_start_grace(struct lock_manager *lm)
 {
 	spin_lock(&grace_lock);
+	printk("lm->name starting grace period\n");
 	list_add(&lm->list, &grace_list);
 	spin_unlock(&grace_lock);
 }
@@ -40,6 +41,7 @@ EXPORT_SYMBOL_GPL(locks_start_grace);
 void locks_end_grace(struct lock_manager *lm)
 {
 	spin_lock(&grace_lock);
+	printk("%s ending grace period\n", lm->name);
 	list_del_init(&lm->list);
 	spin_unlock(&grace_lock);
 }
@@ -54,6 +56,15 @@ EXPORT_SYMBOL_GPL(locks_end_grace);
  */
 int locks_in_grace(void)
 {
-	return !list_empty(&grace_list);
+	if (!list_empty(&grace_list)) {
+		struct lock_manager *lm;
+
+		printk("in grace period due to: ");
+		list_for_each_entry(lm, &grace_list, list)
+			printk("%s ",lm->name);
+		printk("\n");
+		return 1;
+	}
+	return 0;
 }
 EXPORT_SYMBOL_GPL(locks_in_grace);
fs/lockd/svc.c +2 -1
index c061b9a..1638929 100644
@@ -84,6 +84,7 @@ static unsigned long get_lockd_grace_period(void)
 }
 
 static struct lock_manager lockd_manager = {
+	.name = "lockd"
 };
 
 static void grace_ender(struct work_struct *not_used)
@@ -97,8 +98,8 @@ static void set_grace_period(void)
 {
 	unsigned long grace_period = get_lockd_grace_period();
 
-	locks_start_grace(&lockd_manager);
 	cancel_delayed_work_sync(&grace_period_end);
+	locks_start_grace(&lockd_manager);
 	schedule_delayed_work(&grace_period_end, grace_period);
 }
 
fs/nfsd/nfs4state.c +2 -1
index 3787ec1..b83ffdf 100644
@@ -2942,6 +2942,7 @@ out:
 }
 
 static struct lock_manager nfsd4_manager = {
+	.name = "nfsd4",
 };
 
 static void
@@ -4563,7 +4564,6 @@ __nfs4_state_start(void)
 	int ret;
 
 	boot_time = get_seconds();
-	locks_start_grace(&nfsd4_manager);
 	printk(KERN_INFO "NFSD: starting %ld-second grace period\n",
 	       nfsd4_grace);
 	ret = set_callback_cred();
@@ -4575,6 +4575,7 @@ __nfs4_state_start(void)
 	ret = nfsd4_create_callback_queue();
 	if (ret)
 		goto out_free_laundry;
+	locks_start_grace(&nfsd4_manager);
 	queue_delayed_work(laundry_wq, &laundromat_work, nfsd4_grace * HZ);
 	set_max_delegations();
 	return 0;
include/linux/fs.h +1 -0
index ad35091..9501aa7 100644
@@ -1098,6 +1098,7 @@ struct lock_manager_operations {
 };
 
 struct lock_manager {
+	char *name;
 	struct list_head list;
 };
 
#3 lore raw
Quoted 60 lines · Malcolm Locke
Quoted 7 lines · J. Bruce Fields
Quoted 6 lines · Malcolm Locke

First off, apologies for bringing such mundane matters to the list, but we're at the end of our tethers and way out of our depth on this. We have a problem on our production machine that we are unable to replicate on a test machine, and would greatly appreciate any pointers of where to look next.

Quoted 7 lines
Quoted 7 lines

We're in the process of upgrading a DRBD pair running Ubuntu hardy to Debian squeeze. The first of the pair has been upgraded, and NFS works correctly except for locking. Calls to flock() from any client on an NFS mount hang indefinitely.

We've installed a fresh Debian squeeze machine to test, but are completely unable to reproduce the issue.

OK, I've finally managed to reproduce this on our test machine. Given the package list below:

Quoted 11 lines
Quoted 11 lines

Pertinent details about the
set up:

Kernel on both machines:
Linux debian 2.6.32-5-openvz-amd64 #1 SMP Tue Jun 14 10:46:15 UTC 2011 x86_64 GNU/Linux

Debian package versions:
nfs-common 1.2.2-4
nfs-kernel-server 1.2.2-4
rpcbind 0.2.0-4.1

And the following /etc/exports:

  /home        192.168.200.0/24(rw,no_root_squash,async,no_subtree_check)
  /nfs4        192.168.200.0/24(rw,sync,fsid=0,crossmnt)
  /nfs4/flum   192.168.200.0/24(rw,sync)

After a fresh boot:

# Just mount and unmount a v4 mount (192.168.200.187 == localhost)

  $ mount -t nfs4 192.168.200.187:/flum /mnt
  $ umount /mnt
  $ /etc/init.d/nfs-kernel-server stop
  # Comment out the v4 entries from /etc/exports, so only /home remains,
  # and restart the server so v4 is disabled.
  $ /etc/init.d/nfs-kernel-server start

# Mount with v3

  $ mount 192.168.200.187:/home /mnt

# Now trying to flock() will fail, with server staying in grace period

  # ad infinitum
  $ flock /mnt/foo ls

I'm not sure if this is the exact sequence of events we had to get things stuck on our production machine (it's possible), but this sequence will always get the server into indefinite grace period for me.

Quoted 1 line
Quoted 5 lines
Quoted 2 lines

It might be worth trying this in addition to the recoverydir fixes previously posted.

Thanks, I haven't had the opportunity to try this yet but will do so on the test machine and report back if I get time.

Have you gotten a chance to try this?

--b.

Quoted 106 lines
Quoted 106 lines

commit c52560f10794b9fb8c050532d27ff999d8f5c23c

Author: J. Bruce Fields <[email protected]>
Date:   Fri Aug 12 11:59:44 2011 -0400

some grace period fixes and debugging

fs/lockd/grace.c +12 -1
index 183cc1f..61272f7 100644
@@ -22,6 +22,7 @@ static DEFINE_SPINLOCK(grace_lock);
 void locks_start_grace(struct lock_manager *lm)
 {
 	spin_lock(&grace_lock);
+	printk("lm->name starting grace period\n");
 	list_add(&lm->list, &grace_list);
 	spin_unlock(&grace_lock);
 }
@@ -40,6 +41,7 @@ EXPORT_SYMBOL_GPL(locks_start_grace);
 void locks_end_grace(struct lock_manager *lm)
 {
 	spin_lock(&grace_lock);
+	printk("%s ending grace period\n", lm->name);
 	list_del_init(&lm->list);
 	spin_unlock(&grace_lock);
 }
@@ -54,6 +56,15 @@ EXPORT_SYMBOL_GPL(locks_end_grace);
  */
 int locks_in_grace(void)
 {
-	return !list_empty(&grace_list);
+	if (!list_empty(&grace_list)) {
+		struct lock_manager *lm;
+
+		printk("in grace period due to: ");
+		list_for_each_entry(lm, &grace_list, list)
+			printk("%s ",lm->name);
+		printk("\n");
+		return 1;
+	}
+	return 0;
 }
 EXPORT_SYMBOL_GPL(locks_in_grace);
fs/lockd/svc.c +2 -1
index c061b9a..1638929 100644
@@ -84,6 +84,7 @@ static unsigned long get_lockd_grace_period(void)
 }
 
 static struct lock_manager lockd_manager = {
+	.name = "lockd"
 };
 
 static void grace_ender(struct work_struct *not_used)
@@ -97,8 +98,8 @@ static void set_grace_period(void)
 {
 	unsigned long grace_period = get_lockd_grace_period();
 
-	locks_start_grace(&lockd_manager);
 	cancel_delayed_work_sync(&grace_period_end);
+	locks_start_grace(&lockd_manager);
 	schedule_delayed_work(&grace_period_end, grace_period);
 }
 
fs/nfsd/nfs4state.c +2 -1
index 3787ec1..b83ffdf 100644
@@ -2942,6 +2942,7 @@ out:
 }
 
 static struct lock_manager nfsd4_manager = {
+	.name = "nfsd4",
 };
 
 static void
@@ -4563,7 +4564,6 @@ __nfs4_state_start(void)
 	int ret;
 
 	boot_time = get_seconds();
-	locks_start_grace(&nfsd4_manager);
 	printk(KERN_INFO "NFSD: starting %ld-second grace period\n",
 	       nfsd4_grace);
 	ret = set_callback_cred();
@@ -4575,6 +4575,7 @@ __nfs4_state_start(void)
 	ret = nfsd4_create_callback_queue();
 	if (ret)
 		goto out_free_laundry;
+	locks_start_grace(&nfsd4_manager);
 	queue_delayed_work(laundry_wq, &laundromat_work, nfsd4_grace * HZ);
 	set_max_delegations();
 	return 0;
include/linux/fs.h +1 -0
index ad35091..9501aa7 100644
@@ -1098,6 +1098,7 @@ struct lock_manager_operations {
 };
 
 struct lock_manager {
+	char *name;
 	struct list_head list;
 };