The fix for bug #7715 seems to be incomplete. I think downgrade_file_oplock() should also call: flush_write_cache(fsp, SAMBA_OPLOCK_RELEASE_FLUSH); delete_write_cache(fsp); Otherwise a client can: - open a handle (h1) - write some data to h1. - open a 2nd handle h2 (downgrades both handles to level II) - try to read the data on h2 (this gets old data)
Created attachment 10413 [details] Patch for master
Comment on attachment 10413 [details] Patch for master Pushed to master, thanks a lot!
Comment on attachment 10413 [details] Patch for master LGTM.
Re-assigning to Karolin for inclusion in 4.1.next, 4.0.next, 4.2.0.
Comment on attachment 10413 [details] Patch for master Karolin, please git cherry-pick -x fbe40d21c8e0f5bc87635e71fb828dfc5479a1ff to all release branches.
Pushed to autobuild-v4-[0|1|2]-test.
build fails in v4-0-test: smbd/oplock.c: In function 'downgrade_file_oplock': smbd/oplock.c:154: error: 'SAMBA_OPLOCK_RELEASE_FLUSH' undeclared (first use in this function) smbd/oplock.c:154: error: (Each undeclared identifier is reported only once smbd/oplock.c:154: error: for each function it appears in.) The following command failed: gcc -g -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DDEBUG_PASSWORD -DDEVELOPER -g -Wall -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wdeclaration-after-statement -Werror-implicit-function-declaration -I. -I/memdisk/kseeger/a40/b29880/samba3/source3 -I/memdisk/kseeger/a40/b29880/samba3/source3/../lib/iniparser/src -Iinclude/autoconf -Iautoconf -Iautoconf/source3 -Iinclude -I./include -I. -I. -I./../lib/replace -I../lib/ccan/.. -I./librpc -I./.. -I./../lib/tdb_compat -I./../lib/tevent -I../lib/tdb/include -I../lib/ntdb -DHAVE_CONFIG_H -D_GNU_SOURCE -Iinclude/autoconf -Iautoconf -Iautoconf/source3 -Iinclude -I./include -I. -I. -I./../lib/replace -I../lib/ccan/.. -I./librpc -I./.. -I./../lib/tdb_compat -I./../lib/popt -DLDAP_DEPRECATED -I/memdisk/kseeger/a40/b29880/samba3/source3/lib -I.. -I./../lib/ldb/include -D_SAMBA_BUILD_=3 -D_SAMBA_BUILD_=3 -fPIC -c smbd/oplock.c -o smbd/oplock.o make: *** [smbd/oplock.o] Error 1 Re-assigning to metze.
Build fails in v4-1-test: [2920/4128] Compiling source3/smbd/oplock.c ../source3/smbd/oplock.c: In function 'downgrade_file_oplock': ../source3/smbd/oplock.c:154: error: 'SAMBA_OPLOCK_RELEASE_FLUSH' undeclared (first use in this function) ../source3/smbd/oplock.c:154: error: (Each undeclared identifier is reported only once ../source3/smbd/oplock.c:154: error: for each function it appears in.)
Created attachment 10420 [details] Fixed patch for 4.1.next, 4.0.next. Karolin, this updated patch should compile on 4.1.next, 4.0.next. Sorry for the trouble. Jeremy.
(In reply to Jeremy Allison from comment #9) Pushed updated patch to autobuild-v4-[0|1]-test. Pushed original version to v4-2-test. Thanks!
(In reply to Karolin Seeger from comment #10) Pushed to both branches. Closing out bug report. Thanks!
Does this bug and Bug 10428 could cause Samba server in read only state? we have a Samba 4.1.1 server. The Server changed to read only state after copy many file, about 1Tb jpeg files. The directory be locked by oplock EXCLUSIVE+BATCH and pid not exists.