Bug 14997 - Samba4 oplock-handling causes wrong semantics
Summary: Samba4 oplock-handling causes wrong semantics
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.14.7
Hardware: Other Linux
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-05 17:14 UTC by samba
Modified: 2022-03-08 10:20 UTC (History)
0 users

See Also:


Attachments
smb.conf template used by openwrt (5.52 KB, text/plain)
2022-03-08 10:20 UTC, samba
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description samba 2022-03-05 17:14:31 UTC
Server: OpenWrt 21.02.2 (Kernel 5.4.179) on a ramips/mt7621 device with samba4-server 4.14.7-1 installed.
Share (standard configuration) points to logfiles written by rsyslog.

Client: Windows 10 20H2.
When my application opens a logfile on the samba-server (access: read, share: RWD) and reads up to its end of file, I would expect that further reads succeed with more data when rsyslog appends more data to the file.
This used to work with Samba36.
Now the applications never sees new data. Even when I start the app a second time,
opening the file a second time, I only see the data up to the point when the file
was first opened.

Setting
    oplocks = no
on the server solves the problem for me, but It is certainly a hard to trace bug
that should be fixed.

I don't know whether the problem exists on any linux or just on OpenWrt kernels with their space optimization and possible reduced functions.
Comment 1 Jeremy Allison 2022-03-07 19:49:30 UTC
Looks like this kernel isn't breaking oplocks when a local process is opening the file. What is the setting for the:

kernel oplocks

parameter ? If it's set to "no" (the default) then local opens have no effect on Samba oplocks.
Comment 2 samba 2022-03-08 10:20:31 UTC
Created attachment 17195 [details]
smb.conf template used by openwrt

This is the config template used by openwrt.

Also keep in mind that the order in which the files are opened (client+samba or rsyslog first) is arbitrary. The client keeps the file open until the end of the month and I guess rsyslog as well.