samba 3.6.0rc2 question

Jeremy Allison jra at samba.org
Thu Jul 14 18:42:26 MDT 2011


On Wed, Jul 13, 2011 at 03:34:58PM -0700, Herb Lewis wrote:
> I'm trying to use the vfs functions for brl_lock_windows and
> brl_unlock_windows however it doesn't seem like the brl_unlock_windows
> function is getting called on file close unless posiz locks is set.
> 
> locking_close_file is called which in turn calls brl_close_fnum but
> this only calls brl_unlock which is what calls SMB_VFS_BRL_UNLOCK_WINDOWS
> within an if(lp_posix_locking(fsp->conn->params)) clause.
> 
> This seems to be a bug as the vfs unlock routine will never get called
> to release the locks on close. I'm not quite sure where this fix needs
> to go though.

Oh - I see the problem ! We're getting bitten by an optimization
bug which would only bite if you've hooked into the SMB_VFS_BRL_UNLOCK_WINDOWS
call.

The code inside brl_close_fnum() is taking a shortcut if we are not
mapping onto POSIX locks inside smbd.

In that case it "knows" that locks are only stored in the tdb mapped
into memory and so bulk deletes them from the copy of this array
stored on the br_lck struct and re-stores them - WITHOUT calling
the VFS call on each unlock.

It might be that we can just remove this optimization completely.
Give me a little while to create a patch that does this that you
can use. I'll investagate what really needs to get fixed here.

Do you have a reproducible test case on your system I can see ?

I could always pop round to work on this with you. You're still
local, right ?

Cheers,

	Jeremy.


More information about the samba-technical mailing list