In CIFS/SMB protocol, I see that there are 3 types of file handles: durable, resilient and persistent. What is the difference between them?
- Durable handles are part of SMB 2.0
- Resilient handles are part of SMB 2.1
- Persistent handles are part of SMB 2.2 which is now called SMB3
My main references for the following are:
and although this was originally for Samba3, it has more details:
Durable file handles allow a connection to an SMB server to survive a short network outage - durable handles aren't necessarily cleaned up when the opening process terminates. When a client tries to reconnect, if the oplock(/lease) is still there, it reconnects to the file.
But if another client tries to open the file, the oplock/lease is broken and the first client can't reconnect.
Resilient file handles are preserved even if the oplock/lease is broken, but frankly I can't follow all the technical details of how this works. One of the references below says that the difference between Durable and Resilient is how the handles are created - Durable by a create context call and Resilient by an IOCTL. (The main thing I can't follow is how lock sequencing and replay fits into this, but it doesn't look like that's a critical difference between durable and resilient.)
For Persistent handles, I can't come up with anything better than this Samba doc:
Persistent file handles are a like durable file handles with strong guarantees. They are requested with the durable v2 create request blob with the persistent flag set to true. The server only grants persistent handles on shares that are marked CA (continuously available).
As far as I can tell these aren't implemented in Samba yet, but the goal is to support clustering and continuous availability, so it's being worked on.
More about persistent handles...Persistent handles are available across several servers of the same cluster. When one server goes down for any reason, the client machine can semi-transparently continue using this handle over a connection to another server. That's why the implementation of persistent handles (in contrary to durable and resilient handles) is out of a pure SMB scope. For instance, our NQ Storage expects the full semantics of persistent handles to be implemented in a custom VFS, while the SMB engine is responsible for the respective syntax.