[Samba] Oplock break failed for file xxx -- replying anyway

Chenyehua chen.yehua at h3c.com
Tue May 16 08:07:23 UTC 2017

Hi folks
   Recently I met a problem and found “Oplock break failed for file xxx -- replying anyway” in the log, here is the detail:

1)  Background:

A、 Client: windows 7 SP1(pc)

B、 Server: Samba 4.3.11

C、  Protocol: SMB2.1

2)       Phenomenon:

A、 I tried to open my shared directory, and found it was really slow to open(needs 30 more seconds),(Lately I found that same lnk type files existed in the dir, I guess this may be relevant)

B、 The MS office 2010(like word, ppt)also needed 30 more seconds to open(No lnk file existed could also lead to this problem)

C、  Copying files in the shared directory also showed a really bad performance(< 100KB/s)(No lnk file existed could also lead to this problem)

D、 The phenomenon above only happens in some clients, not in all the clients(have not yet found the differences between those windows clients)

3)       Logs:
[2017/05/16 14:50:47.043884, 10, pid=606157, effective(65534, 65534), real(65534, 0)] ../source3/smbd/smb2_break.c:474(send_break_message_smb2)
  send_break_message_smb2: sending oplock break for file aaa/sss.lnk, fnum 411557308, smb2 level 1
… …
… …
[2017/05/16 14:51:17.056975,  0, pid=606157, effective(0, 0), real(0, 0), class=locking] ../source3/smbd/oplock.c:701(oplock_timeout_handler)
Oplock break failed for file aaa/sss.lnk -- replying anyway
  … …
  … …
  [2017/05/16 14:51:17.068473, 10, pid=606157, effective(65534, 65534), real(65534, 0)] ../source3/smbd/smb2_server.c:2018(smbd_smb2_request_dispatch)
  smbd_smb2_request_dispatch: opcode[SMB2_OP_BREAK] mid = 52
[2017/05/16 14:51:17.068496,  4, pid=606157, effective(65534, 65534), real(65534, 0)] ../source3/smbd/uid.c:384(change_to_user)
  Skipping user change - already user
[2017/05/16 14:51:17.068522, 10, pid=606157, effective(65534, 65534), real(65534, 0)] ../source3/smbd/smb2_server.c:2789(smbd_smb2_request_error_ex)
  smbd_smb2_request_error_ex: idx[1] status[NT_STATUS_INVALID_OPLOCK_PROTOCOL] || at ../source3/smbd/smb2_break.c:78
[2017/05/16 14:51:17.068550, 10, pid=606157, effective(65534, 65534), real(65534, 0)] ../source3/smbd/smb2_server.c:2680(smbd_smb2_request_done_ex)
  smbd_smb2_request_done_ex: idx[1] status[NT_STATUS_INVALID_OPLOCK_PROTOCOL] body[8] dyn[yes:1] at ../source3/smbd/smb2_server.c:2837

4)       Analysis, solutions and doubts:


According to the logs above, it may be directly due to the oplock break timeout. I guess for some reason samba may have detected the oplock being break, and then sends an oplock break notification to the client and waiting for the Oplock break acknowledgment until timeout(default OPLOCK_BREAK_TIMEOUT :30s). After 30s, although clients responds to samba, the NT_STATUS_INVALID_OPLOCK_PROTOCOL will be returned as it is not oplock breaking time now.


I tried to set oplocks = no, and the problems did not happen until now, but setting oplocks to no may affect the performance, so I do not want to try this way.

I tried to set blocking locks = no, but it did not work.


My doubts are:

I、               Why does samba send a oplock break notification to some windows 7 client? (As I do not find any oplock break requests when using some other windows 7 clients)

II、             And why do those particular clients not respond to the notification within the acquired time(default 30s)?

III、           Is it a samba bug or a windows client related problem?

IV、           Finally how can I solve this problem without affecting the performance?

Looking forward to your reply, thanks!
Best regards!

This e-mail and its attachments contain confidential information from New H3C, which is
intended only for the person or entity whose address is listed above. Any use of the
information contained herein in any way (including, but not limited to, total or partial
disclosure, reproduction, or dissemination) by persons other than the intended
recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender
by phone or email immediately and delete it!

More information about the samba mailing list