kernel support for open share modes

J. Bruce Fields bfields at
Mon Feb 14 20:17:37 GMT 2005

On Wed, Feb 09, 2005 at 05:01:46PM -0500, bfields wrote:
> OK, that's very interesting, I hadn't noticed the LOCK_MAND, LOCK_READ,
> and LOCK_WRITE constants before.
> One problem is that NFSv4 at least seems to require the setting of deny
> modes to be atomic with open()--so it would be incorrect if, for
> example, we created a file but allowed someone else to beat us to the
> flock().  From a quick look at the use of kernel_flock() it looks like
> this is also a requirement for Samba, and (am I understanding this
> right?) this race is avoided only on the assumption that smbd is the
> *only* user of LOCK_MAND?

Hm.  Another problem that was pointed out to me: an open without deny
bits, which doesn't result in any flock(), doesn't actually prevent
later conflicting opens with deny locks.

Are there ideas for how to fix all this?

--Bruce Fields

More information about the samba-technical mailing list