6

In CIFS/SMB protocol, I see that there are 3 types of file handles: durable, resilient and persistent. What is the difference between them?

8
  • 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:

https://wiki.samba.org/index.php/SMB3_kernel_status

and although this was originally for Samba3, it has more details:

https://wiki.samba.org/index.php/Samba3/SMB2

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.

4

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.

0

Samba Persistent handle maintains file handles' state and even if one of the servers in the cluster goes down, the new master can get the current file handle and continue the I/O without any I/O error.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.