Bug 11243 - kernel_flock and named streams
Summary: kernel_flock and named streams
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:
Blocks:
 
Reported: 2015-04-29 15:37 UTC by Ralph Böhme
Modified: 2021-01-18 11:14 UTC (History)
3 users (show)

See Also:


Attachments
Fix for master (2.18 KB, patch)
2015-04-29 15:41 UTC, Ralph Böhme
vl: review+
jra: review+
Details
Patch for 4.1 cherry-picked from master (2.26 KB, patch)
2015-04-30 08:53 UTC, Ralph Böhme
jra: review+
Details
Patch for 4.2 cherry-picker from master (2.29 KB, patch)
2015-04-30 08:55 UTC, Ralph Böhme
jra: review+
Details
Patch (2.71 KB, patch)
2015-11-05 14:19 UTC, Volker Lendecke
no flags Details
Patch for 4.2 and 4.3 cherry-picked from master (1.32 KB, patch)
2015-11-06 11:20 UTC, Ralph Böhme
vl: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ralph Böhme 2015-04-29 15:37:56 UTC
Streams implementing VFS modules may implement streams in a way that the fsp will have the basefile open in the fsp fd, so lacking a distinct fd for the stream, kernel_flock will apply on the basefile which is wrong.

VFS modules implementing kernel_flock should check whether the fsp refers to a stream and refrain from applying locks on it. Currently vfs_gpfs is the only one affected by this. On a GPFS cluster with "gpfs:sharemodes = yes" (which is the default), the issue can be trigger with smbtorture:

$ ./bin/smbtorture -Uuser%pass //server/share --option=torture:share1=share smb2.streams
smbtorture 4.3.0pre1-DEVELOPERBUILD
Using seed 1430321196
time: 2015-04-29 17:26:36.298447
progress: 1
test: sharemodes
time: 2015-04-29 17:26:36.300014
(../source4/torture/smb2/streams.c:512) Testing stream share mode conflicts
time: 2015-04-29 17:26:38.094048
failure: sharemodes [
(../source4/torture/smb2/streams.c:536) Incorrect status NT_STATUS_SHARING_VIOLATION - should be NT_STATUS_OK
]

Fix coming in a minute.....
Comment 1 Ralph Böhme 2015-04-29 15:41:29 UTC
Created attachment 11002 [details]
Fix for master

With this patch the torture test passes:

$ ./bin/smbtorture -Uuser%pass //server/share --option=torture:share1=share smb2.streams
smbtorture 4.3.0pre1-DEVELOPERBUILD
Using seed 1430321234
time: 2015-04-29 17:27:14.562014
progress: 1
test: sharemodes
time: 2015-04-29 17:27:14.563052
(../source4/torture/smb2/streams.c:512) Testing stream share mode conflicts
time: 2015-04-29 17:27:16.314663
success: sharemodes
Comment 2 Jeremy Allison 2015-04-29 17:51:44 UTC
Comment on attachment 11002 [details]
Fix for master

LGTM. Pushed to master !
Comment 3 Ralph Böhme 2015-04-30 08:53:42 UTC
Created attachment 11003 [details]
Patch for 4.1 cherry-picked from master
Comment 4 Ralph Böhme 2015-04-30 08:55:31 UTC
Created attachment 11004 [details]
Patch for 4.2 cherry-picker from master
Comment 5 Jeremy Allison 2015-04-30 17:08:32 UTC
Re-assigning to Karolin for inclusion in 4.2.next, 4.1.next.
Comment 6 Karolin Seeger 2015-05-05 18:51:41 UTC
Pushed to autobuild-v4-[1|2]-test.
Comment 7 Karolin Seeger 2015-05-10 19:13:24 UTC
Pushed to both branches.
Closing out bug report.

Thanks!
Comment 8 Volker Lendecke 2015-11-05 14:18:34 UTC
If I see it correctly, the change disables GPFS share modes for non-stream files completely.
Comment 9 Volker Lendecke 2015-11-05 14:19:11 UTC
Created attachment 11579 [details]
Patch

Pushing to master
Comment 10 Ralph Böhme 2015-11-05 15:16:16 UTC
Great, I fixed the original bug by completely disabling sharemodes. Sorry!
Comment 11 Jeremy Allison 2015-11-05 18:44:06 UTC
(In reply to Ralph Böhme from comment #10)

Oh, I missed that too in review. Sorry also :-(.
Comment 12 Ralph Böhme 2015-11-06 11:20:25 UTC
Created attachment 11585 [details]
Patch for 4.2 and 4.3 cherry-picked from master
Comment 13 Volker Lendecke 2015-11-06 11:51:54 UTC
Comment on attachment 11585 [details]
Patch for 4.2 and 4.3 cherry-picked from master

Cherry-picked from is missing, but the patch is of course fine
Comment 14 Karolin Seeger 2015-11-16 09:20:03 UTC
Pushed to autobuild-v4-[3|2]-test.
Comment 15 Karolin Seeger 2015-11-17 10:32:43 UTC
(In reply to Karolin Seeger from comment #14)
Pushed to both branches.
Closing out bug report.

Thanks!