SMB CIFS OpLocks - where is the danger?

0

I had some CIFS messages in my dmesg output

[15064.932559] CIFS VFS: Cancelling wait for mid 37736 cmd: 5
[15064.932592] CIFS VFS: Cancelling wait for mid 37737 cmd: 16
[15064.932610] CIFS VFS: Cancelling wait for mid 37738 cmd: 6
[15066.212283] CIFS VFS: Close unmatched open

and startet to dig around where they come from. In the end I found out it has to do with opportunistic locking on the samba share. I found many articles arguing that enable_oplocks will increase performance. There where also as many articles claiming that using oplocks may cause dataloss. My question is: why would dataloss happen?

I found an explaination of how oplocks work (Figure 5.8). There is also some explaination that if the linux kernel does not support oplocks things might break. But can something go wrong if it does support it?

Also: how can I test if my kernel does support oplocks?

I am looking for answers where I learn how oplocks work and how they are implemented/handled in linux, rathern than answers dealing with my specific linux distribution.

masgo

Posted 2019-09-11T10:52:47.393

Reputation: 1 541

Answers

0

To answer your first question: Opportunistic locking is "dangerous" because it gives the user working on a client the feedback that his work has been saved when in reality that saving was done only against the local caching inside the client. I.e. when the client crashes or the network connection to the server experiences problems after the user has received feedback indicating his save operation was successful, he can still loose his work/edits, even if the server implements opportunistic locks perfectly.

Regarding the support of linux for opportunistic locking, you may find this conference report an interesting read: https://lwn.net/Articles/788335/

Eradian

Posted 2019-09-11T10:52:47.393

Reputation: 66

Thanks, thats at lease one point of failure I didn't think of. But even with your case, the data on the server would be okay, no loss or integrity problem on the server. – masgo – 2019-09-17T20:46:26.023

you are welcome.... and "yes and no": on the server you will have outdated information vis-a-vis the expectation of your client. Local integrity will be ok, but in a distributed system (client/server) such a local definition of integrity may not be too useful. – Eradian – 2019-09-17T20:55:51.007