Bug 10921 - possible data corruption using "write cache size != 0"
Summary: possible data corruption using "write cache size != 0"
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on: 7715
Blocks: 10911
  Show dependency treegraph
 
Reported: 2014-11-06 08:23 UTC by Stefan Metzmacher
Modified: 2015-04-15 09:28 UTC (History)
2 users (show)

See Also:


Attachments
Patch for master (1005 bytes, patch)
2014-11-06 08:26 UTC, Stefan Metzmacher
jra: review+
metze: review+
Details
Fixed patch for 4.1.next, 4.0.next. (1016 bytes, patch)
2014-11-08 00:00 UTC, Jeremy Allison
metze: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Metzmacher 2014-11-06 08:23:18 UTC
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)
Comment 1 Stefan Metzmacher 2014-11-06 08:26:04 UTC
Created attachment 10413 [details]
Patch for master
Comment 2 Volker Lendecke 2014-11-06 09:51:24 UTC
Comment on attachment 10413 [details]
Patch for master

Pushed to master, thanks a lot!
Comment 3 Jeremy Allison 2014-11-06 16:56:26 UTC
Comment on attachment 10413 [details]
Patch for master

LGTM.
Comment 4 Jeremy Allison 2014-11-06 16:56:52 UTC
Re-assigning to Karolin for inclusion in 4.1.next, 4.0.next, 4.2.0.
Comment 5 Stefan Metzmacher 2014-11-07 07:50:33 UTC
Comment on attachment 10413 [details]
Patch for master

Karolin, please git cherry-pick -x fbe40d21c8e0f5bc87635e71fb828dfc5479a1ff
to all release branches.
Comment 6 Karolin Seeger 2014-11-07 19:56:04 UTC
Pushed to autobuild-v4-[0|1|2]-test.
Comment 7 Karolin Seeger 2014-11-07 20:06:41 UTC
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.
Comment 8 Karolin Seeger 2014-11-07 20:15:15 UTC
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.)
Comment 9 Jeremy Allison 2014-11-08 00:00:44 UTC
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.
Comment 10 Karolin Seeger 2014-11-09 19:48:45 UTC
(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!
Comment 11 Karolin Seeger 2014-11-10 20:36:54 UTC
(In reply to Karolin Seeger from comment #10)
Pushed to both branches.

Closing out bug report.

Thanks!
Comment 12 crashskyshadow 2015-04-15 09:28:40 UTC
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.