[Samba] blocking file locks
jra at samba.org
Thu Apr 23 10:33:01 GMT 2009
On Tue, Apr 21, 2009 at 09:53:37AM -0800, Larry Dickson wrote:
> Hello all,
> As a Samba programming newbie, I've run onto a question that doesn't have an
> obvious answer in FAQ or googled literature. I need to lock large numbers of
> files on the server, and have Samba open requests block until they are
> released. I found references to "blocking locks" in references such as
> "Using Samba" (O'Reilly, 1999, 2003)
> but these refer to range locks, which are overkill for my application (I
> only need to check on open, not on every IO).
> Deny modes would seem to fill the bill, but I can't find whether blocking
> locks would work for them, and also they do not seem to be Linux-compatible
> on the server, and I suspect I may need that for efficiency's sake (a lot of
> files are being locked/unlocked). I downloaded samba-latest.tar.gz and
> noticed that source/smbd/blocking.c seems to respond to these by setting
> LOCK_MAND versions of flock states, which are available only for "sys_flock"
> and rumored not to affect normal Linux programming.
> Can file locks block a Samba open request? Can they be set by, or made to
> affect, Linux programming on the server (I don't care about NFS file opens,
> only local opens on the server)? Does this drive special Samba kernel code,
> or does smbd just operate in user space?
File locks can't block an open request. On a Linux kernel
you can use file leases to prevent other local opens.
More information about the samba