Samba 3.6.12 While running smbtorture RW2 test, it FAILED with the following error. # smbtorture //path_to_test_share -U user%password -W workgroup -N2 --samba RW2 using seed 1397624068 ... 2 clients started run_readwritemulti: fname \XX752ed930 run_readwritemulti: fname \XX752ed930 unlink failed (NT_STATUS_OBJECT_NAME_NOT_FOUND) (normal, this file should not exist) second open read-only of \XX752ed930 failed (NT_STATUS_OBJECT_NAME_NOT_FOUND) 20 131069 TEST RW2 FAILED! RW2 took 1.07827 secs ############################################################################### "RW2 -N = 2" uses (forks) two clients. The first one will open() with O_CREAT | O_RDWR to create/write a file. The second one will open() with O_RDONLY to read the same file. It looks to me there is a bug in torture.c:rw_torture3(). The second client can fail to open the file if it races and comes before the first client creates the file. The status check on the second client open probably not right e.g. "break if status != NT_STATUS_NOT_FOUND" rather than ""break if !NT_STATUS_IS_OK(status)". Otherwise, the loop of try open doesn't make sense to me. The samba 4.1.7 code has the similar issue. if (procnum == 0) { if (!NT_STATUS_IS_OK(cli_unlink(c, lockfname, FILE_ATTRIBUTE_SY$ printf("unlink failed (%s) (normal, this file should no$ } if (!NT_STATUS_IS_OK(cli_open(c, lockfname, O_RDWR | O_CREAT | $ DENY_NONE, &fnum))) { printf("first open read/write of %s failed (%s)\n", lockfname, cli_errstr(c)); return False; } } else { for (i = 0; i < 500 && fnum == (uint16_t)-1; i++) { status = cli_open(c, lockfname, O_RDONLY, DENY_NONE, &fnum); if (!NT_STATUS_IS_OK(status)) { <===== Should not have "!"? break; } smb_msleep(10); } if (!NT_STATUS_IS_OK(status)) { printf("second open read-only of %s failed (%s)\n", lockfname, cli_errstr(c)); return False; } }
Created attachment 10068 [details] patch This is ancient... 2009ish. Entirely right! These days we'd code this soo much differently :-) Volker
Comment on attachment 10068 [details] patch LGTM
Re-assigning to Karolin for inclusion in 4.1.next. 4.0.next. Jeremy.
(In reply to comment #3) > Re-assigning to Karolin for inclusion in 4.1.next. 4.0.next. > Jeremy. Pushed to autobuild-v4-[0|1]-test.
(In reply to comment #4) > (In reply to comment #3) > > Re-assigning to Karolin for inclusion in 4.1.next. 4.0.next. > > Jeremy. > > Pushed to autobuild-v4-[0|1]-test. Pushed to both branches. Closing out bug report. Thanks!