[Samba] oplocks issue when trying to copy file

Jeremy Allison jra at samba.org
Mon Oct 24 18:35:01 MDT 2011


On Wed, Oct 19, 2011 at 11:33:32PM -0700, Philip Ong wrote:
> I've narrowed this problem down to a patch that is applied in 2.6.36.3. I replaced file.c from 2.6.36.2 into 2.6.36.3 and Samba works fine. The problem is I'm not sure if Samba needs to be fixed or the kernel needs to be. Anyone know what the right action is? One thing I noticed was the invalid argument being sent in the debugging log.
> 
> "  linux_set_kernel_oplock: Refused oplock on file home/foo/open/test.cfg, fd = 33, file_id = 17:aa41ab:0. (Invalid argument)"
> 
> Any advice would help.
> 
> Thanks,
> Phil
> 
> 
> The commit 129a84de2347002f09721cda3155ccfd19fade40 (locks: fix F_GETLK
> regression (failure to find conflicts)) fixed the posix_test_lock()
> function by itself, however, its usage in NFS changed by the commit
> 9d6a8c5c213e34c475e72b245a8eb709258e968c (locks: give posix_test_lock
> same interface as ->lock) remained broken - subsequent NFS-specific
> locking code received F_UNLCK instead of the user-specified lock type.
> To fix the problem, fl->fl_type needs to be saved before the
> posix_test_lock() call and restored if no local conflicts were reported.

Looking closer at the problem...

We simply call fcntl(fd, F_SETLEASE, leasetype) on a fd to
get a kernel oplock on it.

int leasetype can be F_WRLCK or F_UNLCK (from Samba). This
matches the fcntl F_SETLEASE documentation completely. There
has been no change whatsoever in Samba in this regard.

So I'm definitely calling kernel regression bug on this one.

Jeremy.


More information about the samba mailing list