[PATCH] Convert Samba to OFD locking.

Uri Simchoni uri at samba.org
Thu May 19 17:34:37 UTC 2016

On 05/19/2016 06:42 PM, Jeremy Allison wrote:
> On Thu, May 19, 2016 at 08:14:06AM +0300, Uri Simchoni wrote:
>> On 05/19/2016 12:42 AM, Jeremy Allison wrote:
>>> Hi Jeff, Steve and Simo,
>>> Here is the patchset we discussed to convert
>>> smbd to open file description locking on
>>> modern kernels. It also includes a regression
>>> test to ensure we stay working even on systems
>>> that don't have the required kernels :-).
>>> Now all we need is the fix you and I discussed
>>> to the calls to CIFSSMBPosixLock() to convert
>>> the lock context from current->tgid for process-associated
>>> record locks to a handle-specific lock context
>>> for open file description record locks.
>>> This will put us in really good shape for
>>> doing the OFD-POSIX locks we need in the
>>> SMB2+ UNIX extensions protocol changes.
>>> Please review and let me know !
>>> Cheers,
>>> Jeremy.
>> Seems like the wscript test is a compile-time test. Should be a test
>> that runs code to verify the kernel actually supports it (or gets it
>> from the answer file and fails if there's no answer). The fcntl_lock
>> test just above it can be a good reference.
> No. I don't think runtime tests are a good idea.
> They've lead to a host of spaghetti code trying
> to create 'fall-backs' for features that don't
> work. This code in Linux (written by Jeff) is
> either there or not. I'm not going to try and
> second guess if it works or not :-).
My angle is custom-built (and probably cross-compiled) linux, such as we
see in NAS appliances. For that purpose a runtime test is not needed
(and I was not asking for one) - a configure-time test that runs would

I tend to agree with Richard that the kernel is usually newer than the
toolchain (and libc), but as a safety measure, we should at least panic
if fcntl fails with EINVAL - can't hide this error.


More information about the samba-technical mailing list