Bug 5168 - vfs_noflock to disable flock for broken NFS connections
Summary: vfs_noflock to disable flock for broken NFS connections
Status: RESOLVED WONTFIX
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: VFS (show other bugs)
Version: 3.0.28
Hardware: x64 Linux
: P3 normal
Target Milestone: none
Assignee: Tim Potter
QA Contact: Samba QA Contact
URL: http://hasiru.net/
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-29 05:35 UTC by Reinin Oyama
Modified: 2022-01-12 15:01 UTC (History)
2 users (show)

See Also:


Attachments
VFS noflock patch (3.80 KB, patch)
2007-12-30 10:12 UTC, Reinin Oyama
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Reinin Oyama 2007-12-29 05:35:32 UTC
On Fedora Core 6 Linux, kernel-flock function does not work correctly
with NFS-mounted files.
This causes problem that Excel is not able to open CSV files.
Fcntl F_WRCLK return error 11.

I made a patch to force-off KERNEL_SHARE_MODES not to use flock function as follows.

Apply this patch and do "autoconf -I. -Ilib/replace". 
And do "./configure --enable-kernel-share-modes=no".

--- samba-3.0.28.org/source/configure.in        2007-11-21 12:58:01.000000000 +0900
+++ samba-3.0.28/source/configure.in    2007-12-29 20:07:34.000000000 +0900
@@ -2613,6 +2613,12 @@
 }
 ],
 samba_cv_HAVE_KERNEL_SHARE_MODES=yes,samba_cv_HAVE_KERNEL_SHARE_MODES=no,samba_cv_HAVE_KERNEL_SHARE_MODES=cross)])
+
+AC_ARG_ENABLE(kernel_share_modes, [  --enable-kernel-share-modes      Turn on kernel_share_modes (default=yes)])
+if test x$enable_kernel_share_modes = xno; then
+    samba_cv_HAVE_KERNEL_SHARE_MODES=no
+fi
+
 if test x"$samba_cv_HAVE_KERNEL_SHARE_MODES" = x"yes"; then
     AC_DEFINE(HAVE_KERNEL_SHARE_MODES,1,[Whether the kernel supports share modes])
 fi
Comment 1 Volker Lendecke 2007-12-29 09:23:36 UTC
the flock operation is passed through the VFS these days. I'd stronly recommend to write a VFS module that just returns 0 on flock. This way you can make it a per share option.

Volker
Comment 2 Reinin Oyama 2007-12-30 10:12:57 UTC
Created attachment 3082 [details]
VFS noflock patch

OK!!!
I made a patch to add VFS (noflock).
Usage:
 tar zxvf samba-3.0.28.tar.gz
 patch < samba-3.0.28.vfs.patch
 cd samba-3.0.28/source
 autoconf -I. -Ilib/replace
 ./configre
 make install
 add "vfs objects = noflock" into smb.conf.
 run nmbd and smbd.
Comment 3 Reinin Oyama 2007-12-30 17:29:31 UTC
correction:
patch -p0 < samba-3.0.28.vfs.patch 
Comment 4 Reinin Oyama 2007-12-30 18:01:11 UTC
./configre -> ./configure
Comment 5 Volker Lendecke 2007-12-31 03:06:07 UTC
Thanks!

I know it's trivial, but are you ok with putting that module under GPLv2+? Pulic domain IMO in particular means that we can do anything with it, but I would like to confirm it.

Volker
Comment 6 Luzian Scherrer (dead mail address) 2008-01-22 02:58:30 UTC
The description of this bug does not say which Linux kernel versions are affected by this problem. I had the same issue (NFS share exported via Samba, users can open MS Office files only in read-only mode) with this system: Linux 2.6.16.54-0.2.3-default, SUSE Linux Enterprise Server (SLES) 10 SP1. I've applied this patch and the problem is solved. Will this patch be included in 3.0.29?
Comment 7 Volker Lendecke 2008-01-22 03:10:15 UTC
I'm still waiting for confirmation by the patch author that it is ok to GPLv3 the code.

Volker
Comment 8 Björn Jacke 2020-12-30 00:13:18 UTC
Reinin, can you answer Volker's request?
Comment 9 Björn Jacke 2022-01-12 15:01:42 UTC
closing this as WONFTFIX now.

An alternative is also to set "kernel share modes = no" and "posix locking = no".