There is an issue that I can reproduce ever time on 4.1.6 and 4.1.8 and probably on other smbd daemons which in certain scenarios can corrupt (truncate) files. An example of such situation involves two PC-s (PC1 and PC2). PC1 has installed Office 2003 and 2010, and PC2 has only wordpad installed. Now, open the same folder on samba share with both PCs and with PC1 create empty word file "WORD". Now, with PC2 open that file with wordpad, and after that WITH Word IN PC1. Now, when you have in parallel both files opened, click save on wordpad which will result with error window saying that the file is already opened and used by other process THE ISSUE HERE IS THAT SAMBA IN BACKGROUND CALLS OPEN with O_TRUNC WHICH DESTROYS ALL PAST FILE CONTENTS. I tried this with oplocks enabled and disabled. If you need logs please tell me. I did not include the logs since the problem can be easily reproduced on any machine.
HMMM. It might well be you just found a problem indeed.... :-( Can you send a wireshark trace of the failure?
Created attachment 10046 [details] Wireshark Network Trace
This is a bug that came in with 4.1. Use 4.0 as an emergency workaround.
Is there some temporary workaround for 4.1 or should I wait official patch for this bug?
Sorry, the only workaround is to downgrade to 4.0.
Ok, thank you for your help
(In reply to comment #6) > Ok, thank you for your help Yep. This is a bad bug - we'll get a fix for you to test ASAP ! Thanks for reporting. Jeremy.
Created attachment 10049 [details] git-am fix for master. Actual fix based on Volker's work but adds regression test. The S_ISFIFO check may not be strictly necessary, but doesn't hurt (might make the code a bit more complex than it needs to be) - Volker, feel free to remove that part if you wish. Jeremy.
Created attachment 10050 [details] git-am fix for 4.1.next. Back-ported from the master patch.
I have tested the patch on freshly compiled 4.1.9 version, and I can confirm that this patch does resolve this issue.
(In reply to comment #10) > I have tested the patch on freshly compiled 4.1.9 version, and I can confirm > that this patch does resolve this issue. Great ! Thanks for your help in reviewing. Let's wait until Volker gets a chance to review and if he's happy we'll get this into master + a release asap ! Cheers, Jeremy.
Comment on attachment 10049 [details] git-am fix for master. This is certainly good to go. I've added to minor patches on top of this, sending it to samba-technical for (hopefully quick) review before pushing
Re-assigning to Karolin for inclusion in 4.1.next. Jeremy.
Created attachment 10054 [details] git-am fix for 4.1.next with vl's cleanup, without smbtorture test. I'd like to keep both master and the 4.1 branch consistent. Jeremy, do you mind if we merge both your fix and Volker's cleanup patch? Please see attached.
Comment on attachment 10054 [details] git-am fix for 4.1.next with vl's cleanup, without smbtorture test. LGTM.
Comment on attachment 10050 [details] git-am fix for 4.1.next. Thanks for the feedback Volker and Jeremy - marking previous patch obsolete.
(In reply to comment #15) > Comment on attachment 10054 [details] > git-am fix for 4.1.next with vl's cleanup, without smbtorture test. > > LGTM. Pushed to autobuild-v4-1-test.
Do we know if samba versions prior 4.1.x are affected as well ?
(In reply to comment #18) > Do we know if samba versions prior 4.1.x are affected as well ? 4.1 only
Thanks for confirmation, Volker.
Comment on attachment 10054 [details] git-am fix for 4.1.next with vl's cleanup, without smbtorture test. This fails autobuild: [499/1593 in 41m17s] samba3.smb2.oplock(s3dc) EXCLUSIVE5: open with exclusive oplock second open with attributes only and NTCREATEX_DISP_OVERWRITE_IF dispostion causes oplock break Acking to level II [0x01] in oplock handler Acking to none [0x00] in oplock handler Acking to none [0x00] in oplock handler UNEXPECTED(failure): samba3.smb2.oplock.exclusive5(s3dc) REASON: _StringException: _StringException: (../source4/torture/smb2/oplock.c:710): wrong value for break_info.count got 0x2 - should be 0x1 FAILED (1 failures, 0 errors and 0 unexpected successes in 0 testsuites) A summary with detailed information can be found in: ./bin/ab/summary ERROR: test failed with exit code 1
(In reply to comment #21) > Comment on attachment 10054 [details] > git-am fix for 4.1.next with vl's cleanup, without smbtorture test. > > This fails autobuild: > > [499/1593 in 41m17s] samba3.smb2.oplock(s3dc) > EXCLUSIVE5: open with exclusive oplock > second open with attributes only and NTCREATEX_DISP_OVERWRITE_IF dispostion > causes oplock break > Acking to level II [0x01] in oplock handler > Acking to none [0x00] in oplock handler > Acking to none [0x00] in oplock handler > UNEXPECTED(failure): samba3.smb2.oplock.exclusive5(s3dc) > REASON: _StringException: _StringException: > (../source4/torture/smb2/oplock.c:710): wrong value for break_info.count got > 0x2 - should be 0x1 > > FAILED (1 failures, 0 errors and 0 unexpected successes in 0 testsuites) > > A summary with detailed information can be found in: > ./bin/ab/summary > ERROR: test failed with exit code 1 We need to backport something like: commit 20669d4a75386eef4fdcea07fb99812c4e09de13 Author: Volker Lendecke <vl@samba.org> Date: Thu Sep 26 16:15:31 2013 -0700 smbd: Fix raw.batch.exclusive[59] The level we have to break to depend on the breakers create_disposition: If we overwrite, we have to break to none. This patch overloads the "op_type" field in the break message we send across to the smbd holding the oplock with the oplock level we want to break to. Because it depends on the create_disposition in the breaking open, only the breaker can make that decision. We might want to use a different mechanism for this in the future, but for now using the op_type field seems acceptable to me. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> This was part of a larger patchset: git log -15 cdd232cc06a5652ad9f6800d5baf017632099cd8 Or we decide to ignore the failure...
(In reply to comment #22) > (In reply to comment #21) > > Comment on attachment 10054 [details] [details] > > git-am fix for 4.1.next with vl's cleanup, without smbtorture test. > > > > This fails autobuild: > > > > [499/1593 in 41m17s] samba3.smb2.oplock(s3dc) > > EXCLUSIVE5: open with exclusive oplock > > second open with attributes only and NTCREATEX_DISP_OVERWRITE_IF dispostion > > causes oplock break > > Acking to level II [0x01] in oplock handler > > Acking to none [0x00] in oplock handler > > Acking to none [0x00] in oplock handler > > UNEXPECTED(failure): samba3.smb2.oplock.exclusive5(s3dc) > > REASON: _StringException: _StringException: > > (../source4/torture/smb2/oplock.c:710): wrong value for break_info.count got > > 0x2 - should be 0x1 > > > > FAILED (1 failures, 0 errors and 0 unexpected successes in 0 testsuites) > > > > A summary with detailed information can be found in: > > ./bin/ab/summary > > ERROR: test failed with exit code 1 > > We need to backport something like: > > commit 20669d4a75386eef4fdcea07fb99812c4e09de13 > Author: Volker Lendecke <vl@samba.org> > Date: Thu Sep 26 16:15:31 2013 -0700 > > smbd: Fix raw.batch.exclusive[59] > > The level we have to break to depend on the breakers create_disposition: > If we overwrite, we have to break to none. > > This patch overloads the "op_type" field in the break message we send > across to the smbd holding the oplock with the oplock level we want to > break to. Because it depends on the create_disposition in the breaking > open, only the breaker can make that decision. We might want to use > a different mechanism for this in the future, but for now using the > op_type field seems acceptable to me. > > Signed-off-by: Volker Lendecke <vl@samba.org> > Reviewed-by: Stefan Metzmacher <metze@samba.org> > > This was part of a larger patchset: > git log -15 cdd232cc06a5652ad9f6800d5baf017632099cd8 > > Or we decide to ignore the failure... To be honest -- here I think we should opt to add this to knownfail. During my leases work I already found quite a few cases where Samba breaks oplocks differently from Windows, this would add just one more. Backporting all those fixes is beyond this bug I guess.
(In reply to comment #23) > (In reply to comment #22) > > (In reply to comment #21) > > > Comment on attachment 10054 [details] [details] [details] > > > git-am fix for 4.1.next with vl's cleanup, without smbtorture test. > > > > > > This fails autobuild: > > > > > > [499/1593 in 41m17s] samba3.smb2.oplock(s3dc) > > > EXCLUSIVE5: open with exclusive oplock > > > second open with attributes only and NTCREATEX_DISP_OVERWRITE_IF dispostion > > > causes oplock break > > > Acking to level II [0x01] in oplock handler > > > Acking to none [0x00] in oplock handler > > > Acking to none [0x00] in oplock handler > > > UNEXPECTED(failure): samba3.smb2.oplock.exclusive5(s3dc) > > > REASON: _StringException: _StringException: > > > (../source4/torture/smb2/oplock.c:710): wrong value for break_info.count got > > > 0x2 - should be 0x1 > > > > > > FAILED (1 failures, 0 errors and 0 unexpected successes in 0 testsuites) > > > > > > A summary with detailed information can be found in: > > > ./bin/ab/summary > > > ERROR: test failed with exit code 1 > > > > We need to backport something like: > > > > commit 20669d4a75386eef4fdcea07fb99812c4e09de13 > > Author: Volker Lendecke <vl@samba.org> > > Date: Thu Sep 26 16:15:31 2013 -0700 > > > > smbd: Fix raw.batch.exclusive[59] > > > > The level we have to break to depend on the breakers create_disposition: > > If we overwrite, we have to break to none. > > > > This patch overloads the "op_type" field in the break message we send > > across to the smbd holding the oplock with the oplock level we want to > > break to. Because it depends on the create_disposition in the breaking > > open, only the breaker can make that decision. We might want to use > > a different mechanism for this in the future, but for now using the > > op_type field seems acceptable to me. > > > > Signed-off-by: Volker Lendecke <vl@samba.org> > > Reviewed-by: Stefan Metzmacher <metze@samba.org> > > > > This was part of a larger patchset: > > git log -15 cdd232cc06a5652ad9f6800d5baf017632099cd8 > > > > Or we decide to ignore the failure... > > To be honest -- here I think we should opt to add this to knownfail. During my > leases work I already found quite a few cases where Samba breaks oplocks > differently from Windows, this would add just one more. Backporting all those > fixes is beyond this bug I guess. Sounds ok for me.
Created attachment 10110 [details] Additional patch for v4-1-test (ignores samba3.smb2.oplock.exclusive5)
Comment on attachment 10110 [details] Additional patch for v4-1-test (ignores samba3.smb2.oplock.exclusive5) I'm OK with this for 4.1.next.
Karolin, please try and push again for 4.1.next - thanks ! Jeremy.
(In reply to comment #27) > Karolin, please try and push again for 4.1.next - thanks ! > > Jeremy. Pushed additional patch to autobuild-v4-1-test. Thanks for investigating!
Pushed to v4-1-test. Closing out bug report. Thanks!