The above URL gives the entire bug report from our user. I'm just passing it through as, frankly, this goes much further than my own expertise Getting more details or rationale probably needs to get in touch with the original bug submitter... -- Christian Perrier, on behalf of samba package maintainers in Debian
I'm the original reporter. it's been a while since i reported this, but i'm happy to dig back into my notes if i can help move the problem toward a resolution.
I am using the test program, the only modification I did was to add a printf in the else of both if (0 != fcntl()) statements. I do not see errors, the F_SETLK command with F_WRLCK type succeeds. Using cifs vfs version 1.57 and samba server version 3.2.5.
cifstest6:~ # grep mnt /proc/mounts //cifstest8/smb8 /mnt/smb_a cifs rw,mand,unc=\\cifstest8\smb8, username=root,addr=9.3.123.456,posixpaths,acl,rsize=16384,wsize=57344 0 0 cifstest6:~ # echo -n a > /mnt/smb_a/foo cifstest6:~ # chmod g+s,g-x /mnt/smb_a/foo cifstest6:~ # ls -la /mnt/smb_a/foo -rwxr--r-- 1 nobody nobody 1 Mar 5 13:35 /mnt/smb_a/foo cifstest6:~ # /tmp/fcntltest /mnt/smb_a/foo fcntl fd F_RDLCK SETLK64 succeeded fcntl fd F_WRLCK SETLK64 succeeded
Shirish mentioned this bug is not reproducible on 3.2.5
How about this situation: I have an sqlite3 file that is hosted on a Windows XP machine. The share is mounted via mount.cifs on my Fedora 14 client machine. Whenever I try to use the sqlite3 file, I get locking errors. Some searches on the web referred to the nobrl option and eventually lead to this bug report. Using nobrl indeed does remove the locking errors, but is not really a good solution. I googled for "sqlite3 cifs" and it returned several threads along the same lines. The problem also appears when a Vista server is used (according to these threads). And some seem to suggest that the problem doesn't happen when working between Windows machines (ie using a Windows pc for both the server side and the client side). It's not clear to me if my issue is what this bug is about, but I got here via lauchpad bug 117730, which linked to the debian bug in the url above which got me here. It seems this bug has been closed because it was not reproducible with a Samba server. I am however using a Windows XP machine as a server, and only use the mount.cifs client application. Is that supposed to work without problems ? I sure doesn't for me. If it should, then IMO this bug should be reopened.
Looks like this issue was not fixed by now (Ubuntu bionic 18.04.3) Same behavior as described with sqlite3 and strace: ... fcntl(3, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=1073741824, l_len=1}) = 0 fcntl(3, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=1073741826, l_len=510}) = -1 EACCES (Permission denied) the second one fcntl works fine on local filesystem but not on cifs 2.10, kernel 4.15.0-72 The workaround is to mount samba share with nobrl option Please adjust status of this issue, this should be CONFIRMED