Skip to contentSkip to conversation

server does not abort grace period

DISCUSSION Ferenc Wagner 2 participants 8 messages Feb 11, 2011 – Feb 25, 2011

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

Hi,

We're running 2.6.32 (Debian squeeze) NFS4 server and clients. The server boots and runs purely from SAN, so we can start it on different computers. In case of such "hardware failovers" I'd expect the clients to quickly reclaim their locks (if any) and thus the server to abort it's 90-second grace period early. However, this does not happen, ruining our HA like, totally.

So, the questions: is the functionality of aborting the grace period early missing from version 2.6.32 of the Linux kernel? If yes, is it present in any kernel version? If it should work, could someone offer some advice on debugging it? If it isn't supported, what's the best practice of providing highly available NFSv4 today?

Signature · 2 lines
Thanks,
Feri.
#1 lore raw
Quoted 7 lines · Ferenc Wagner

We're running 2.6.32 (Debian squeeze) NFS4 server and clients. The server boots and runs purely from SAN, so we can start it on different computers. In case of such "hardware failovers" I'd expect the clients to quickly reclaim their locks (if any) and thus the server to abort it's 90-second grace period early. However, this does not happen, ruining our HA like, totally.

Quoted 5 lines

So, the questions: is the functionality of aborting the grace period early missing from version 2.6.32 of the Linux kernel? If yes, is it present in any kernel version? If it should work, could someone offer some advice on debugging it? If it isn't supported, what's the best practice of providing highly available NFSv4 today?

Hi,

Could somebody please share any related wisdom? Pretty please? In short, how to fight grace period in a HA NFS4 setup? Decreasing it (of course after cutting the lock lease time) seems a rather big hammer, I'd like to avoid using it if reasonably possible.

Signature · 2 lines
Thanks,
Feri.
#2 lore raw
Quoted 15 lines · Ferenc Wagner
Quoted 7 lines · Ferenc Wagner

We're running 2.6.32 (Debian squeeze) NFS4 server and clients. The server boots and runs purely from SAN, so we can start it on different computers. In case of such "hardware failovers" I'd expect the clients to quickly reclaim their locks (if any) and thus the server to abort it's 90-second grace period early. However, this does not happen, ruining our HA like, totally.

Quoted 5 lines

So, the questions: is the functionality of aborting the grace period early missing from version 2.6.32 of the Linux kernel? If yes, is it present in any kernel version? If it should work, could someone offer some advice on debugging it? If it isn't supported, what's the best practice of providing highly available NFSv4 today?

Quoted 6 lines

Hi,

Could somebody please share any related wisdom? Pretty please? In short, how to fight grace period in a HA NFS4 setup? Decreasing it (of course after cutting the lock lease time) seems a rather big hammer, I'd like to avoid using it if reasonably possible.

The NFSv4.0 protocol doesn't provide any way for clients to tell the server that they have finished recovering; as long as *any* clients held state on the previous server instance, the new server is stuck waiting out the whole grace period. Some things we could do:

- We could at least recognize the case where *no* clients held state before, and end the grace period early in that case.
- In the NFSv4.1 case there is a "reclaim complete" rpc that clients are required to send. Currently we don't take advantage of that to end the grace period early, but we should. That's no help for 4.0 clients.
- We could record a count of all locks/opens held in stable storage and use that to decide when a client is done recovering. That would be complicated and risk slowing down normal opens and locks a lot.

In short, it's hard.

I don't think decreasing the lease time would be so terrible. Perhaps the default should even be a little less.

--b.

#3 lore raw

"J. Bruce Fields" <[email protected]> writes:

First of all, thank you very much for the detailed and useful reply!

Quoted 22 lines · Ferenc Wagner
Quoted 16 lines
Quoted 7 lines · Ferenc Wagner

We're running 2.6.32 (Debian squeeze) NFS4 server and clients. The server boots and runs purely from SAN, so we can start it on different computers. In case of such "hardware failovers" I'd expect the clients to quickly reclaim their locks (if any) and thus the server to abort it's 90-second grace period early. However, this does not happen, ruining our HA like, totally.

Quoted 5 lines

So, the questions: is the functionality of aborting the grace period early missing from version 2.6.32 of the Linux kernel? If yes, is it present in any kernel version? If it should work, could someone offer some advice on debugging it? If it isn't supported, what's the best practice of providing highly available NFSv4 today?

Quoted 4 lines

Could somebody please share any related wisdom? Pretty please? In short, how to fight grace period in a HA NFS4 setup? Decreasing it (of course after cutting the lock lease time) seems a rather big hammer, I'd like to avoid using it if reasonably possible.

Quoted 7 lines

The NFSv4.0 protocol doesn't provide any way for clients to tell the server that they have finished recovering; as long as *any* clients held state on the previous server instance, the new server is stuck waiting out the whole grace period. Some things we could do:

- We could at least recognize the case where *no* clients held state before, and end the grace period early in that case.

Would this mean that /var/lib/nfs/v4recovery is empty on the server? Actually, it contains a hex-named empty directory, sometimes two (we're running with two clients at the moment).

Quoted 4 lines

- In the NFSv4.1 case there is a "reclaim complete" rpc that clients are required to send. Currently we don't take advantage of that to end the grace period early, but we should. That's no help for 4.0 clients.

/proc/fs/nfsd/versions shows +4.1 on the server, does this mean that nfs4 type Linux client mounts should issue "reclaim complete"? I see that it won't help anyway at the moment, lacking server support, just out of interest...

Quoted 4 lines

- We could record a count of all locks/opens held in stable storage and use that to decide when a client is done recovering. That would be complicated and risk slowing down normal opens and locks a lot.

And the "reclaim complete" client RPC seems must better anyway, as the server and the client may get out of sync in case of an unclean client shutdown.

Quoted 2 lines

I don't think decreasing the lease time would be so terrible. Perhaps the default should even be a little less.

Fine, then. Does the Linux nfs server implementation use the lease time of the previous server instance as grace period on startup, or does it simply take whatever it finds in /proc/fs/nfsd/nfsv4leasetime?

Signature · 2 lines
Thanks for taking time,
Feri.
#4 lore raw
Quoted 10 lines · Ferenc Wagner
Quoted 7 lines · J. Bruce Fields

The NFSv4.0 protocol doesn't provide any way for clients to tell the server that they have finished recovering; as long as *any* clients held state on the previous server instance, the new server is stuck waiting out the whole grace period. Some things we could do:

- We could at least recognize the case where *no* clients held state before, and end the grace period early in that case.

Would this mean that /var/lib/nfs/v4recovery is empty on the server?

Right.

Quoted 10 lines

Actually, it contains a hex-named empty directory, sometimes two (we're running with two clients at the moment).

Quoted 4 lines

- In the NFSv4.1 case there is a "reclaim complete" rpc that clients are required to send. Currently we don't take advantage of that to end the grace period early, but we should. That's no help for 4.0 clients.

/proc/fs/nfsd/versions shows +4.1 on the server, does this mean that nfs4 type Linux client mounts should issue "reclaim complete"?

It means that a 4.1 is supported, so a client *could* use 4.1 if it asked to. And if it did use 4.1, yes, it would be required to issue reclaim complete. Current linux clients do not use 4.1 unless you explicitly ask for it on the mont commandline.

(Aside: the server really shouldn't have +4.1 by default, as the 4.1 server is not done. We should fix that; which distro are you using?)

Quoted 13 lines

I see
that it won't help anyway at the moment, lacking server support, just out of interest...

Quoted 4 lines

- We could record a count of all locks/opens held in stable storage and use that to decide when a client is done recovering. That would be complicated and risk slowing down normal opens and locks a lot.

And the "reclaim complete" client RPC seems must better anyway, as the server and the client may get out of sync in case of an unclean client shutdown.

Quoted 6 lines
Quoted 2 lines

I don't think decreasing the lease time would be so terrible. Perhaps the default should even be a little less.

Fine, then. Does the Linux nfs server implementation use the lease time of the previous server instance as grace period on startup, or does it simply take whatever it finds in /proc/fs/nfsd/nfsv4leasetime?

The latest server has separately tunable "nfsv4gracetime" and "nfsv4leasetime", and if you want to be careful, you should:

- stop the server
- set nfsv4gracetime to the *previous* lease time
- set nfsv4leasetime to the *new* lease time
- start the server

That gives you the new (lower) lease time while still giving a sufficiently long grace period for clients who only knew about the old time to recover. After doing that once, on future restarts you can use the shorter time for both.

Probably we should write utilites which do this right for you....

--b.

#5 lore raw
Quoted 9 lines · J. Bruce Fields
Quoted 7 lines · Ferenc Wagner
Quoted 4 lines · J. Bruce Fields

- In the NFSv4.1 case there is a "reclaim complete" rpc that clients are required to send. Currently we don't take advantage of that to end the grace period early, but we should. That's no help for 4.0 clients.

Quoted 7 lines
Quoted 2 lines

/proc/fs/nfsd/versions shows +4.1 on the server, does this mean that nfs4 type Linux client mounts should issue "reclaim complete"?

It means that a 4.1 is supported, so a client *could* use 4.1 if it asked to. And if it did use 4.1, yes, it would be required to issue reclaim complete. Current linux clients do not use 4.1 unless you explicitly ask for it on the mount commandline.

I can't find any mention of 4.1 in man nfs (nfs-common version 1.2.2), is there an undocumented nfsvers=4.1 mount option or some other means?

Quoted 2 lines

(Aside: the server really shouldn't have +4.1 by default, as the 4.1 server is not done. We should fix that; which distro are you using?)

Debian squeeze. If it's switchable, then it's possible I switched it on, I can't remember. However, 4.1 client support is disabled in the stock kernel config, and 4.1 server support isn't even mentioned:

$ fgrep NFS /boot/config-2.6.32-5-686 
CONFIG_NFS_FS=m
CONFIG_NFS_V3=y
CONFIG_NFS_V3_ACL=y
CONFIG_NFS_V4=y
# CONFIG_NFS_V4_1 is not set
CONFIG_NFS_FSCACHE=y
CONFIG_NFSD=m
CONFIG_NFSD_V2_ACL=y
CONFIG_NFSD_V3=y
CONFIG_NFSD_V3_ACL=y
CONFIG_NFSD_V4=y
CONFIG_NFS_ACL_SUPPORT=m
CONFIG_NFS_COMMON=y
CONFIG_NCPFS_NFS_NS=y
Quoted 12 lines
Quoted 3 lines

Does the Linux nfs server implementation use the lease time of the previous server instance as grace period on startup, or does it simply take whatever it finds in /proc/fs/nfsd/nfsv4leasetime?

The latest server has separately tunable "nfsv4gracetime" and "nfsv4leasetime", and if you want to be careful, you should:

- stop the server
- set nfsv4gracetime to the *previous* lease time
- set nfsv4leasetime to the *new* lease time
- start the server

Quoted 4 lines

That gives you the new (lower) lease time while still giving a sufficiently long grace period for clients who only knew about the old time to recover. After doing that once, on future restarts you can use the shorter time for both.

Yes, this is exactly where I was going to (and what's recommended in the RFC). Good to hear it's already implemented!

Quoted 1 line

Probably we should write utilites which do this right for you....

No worries, I won't be changing the lease time that frequently. :)

Signature · 2 lines
Thanks a lot,
Feri.
#6 lore raw
Quoted 14 lines · Ferenc Wagner
Quoted 12 lines · J. Bruce Fields
Quoted 9 lines · Ferenc Wagner
Quoted 4 lines · J. Bruce Fields

- In the NFSv4.1 case there is a "reclaim complete" rpc that clients are required to send. Currently we don't take advantage of that to end the grace period early, but we should. That's no help for 4.0 clients.

/proc/fs/nfsd/versions shows +4.1 on the server, does this mean that nfs4 type Linux client mounts should issue "reclaim complete"?

Quoted 7 lines
Quoted 4 lines

It means that a 4.1 is supported, so a client *could* use 4.1 if it asked to. And if it did use 4.1, yes, it would be required to issue reclaim complete. Current linux clients do not use 4.1 unless you explicitly ask for it on the mount commandline.

I can't find any mention of 4.1 in man nfs (nfs-common version 1.2.2), is there an undocumented nfsvers=4.1 mount option or some other means?

-ominorversion=1

Quoted 6 lines
Quoted 2 lines

(Aside: the server really shouldn't have +4.1 by default, as the 4.1 server is not done. We should fix that; which distro are you using?)

Debian squeeze. If it's switchable, then it's possible I switched it on, I can't remember. However, 4.1 client support is disabled in the stock kernel config, and 4.1 server support isn't even mentioned:

There's no separate config option, but the kernel keeps it off by default. I think nfs-utils is overriding the kernel's default. We should fix that.

--b.

#7 lore raw
Quoted 20 lines · J. Bruce Fields
Quoted 19 lines · Ferenc Wagner
Quoted 16 lines · J. Bruce Fields
Quoted 9 lines · Ferenc Wagner
Quoted 4 lines · J. Bruce Fields

- In the NFSv4.1 case there is a "reclaim complete" rpc that clients are required to send. Currently we don't take advantage of that to end the grace period early, but we should. That's no help for 4.0 clients.

/proc/fs/nfsd/versions shows +4.1 on the server, does this mean that nfs4 type Linux client mounts should issue "reclaim complete"?

It means that a 4.1 is supported, so a client *could* use 4.1 if it asked to. And if it did use 4.1, yes, it would be required to issue reclaim complete. Current linux clients do not use 4.1 unless you explicitly ask for it on the mount commandline.

Quoted 4 lines
Quoted 2 lines

I can't find any mention of 4.1 in man nfs (nfs-common version 1.2.2), is there an undocumented nfsvers=4.1 mount option or some other means?

-ominorversion=1

Hmm, looks like this feature didn't make it into the squeeze version of mount.nfs4. And it's disabled in the kernel, anyway.

Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

(Aside: the server really shouldn't have +4.1 by default, as the 4.1 server is not done. We should fix that; which distro are you using?)

Debian squeeze. If it's switchable, then it's possible I switched it on, I can't remember. However, 4.1 client support is disabled in the stock kernel config, and 4.1 server support isn't even mentioned:

There's no separate config option, but the kernel keeps it off by default. I think nfs-utils is overriding the kernel's default. We should fix that.

At least I can't find any occurence of fs/nfsd/version in my startup and config scripts.

Signature · 2 lines
Regards,
Feri.