record locking behavior

Jeremy Allison jra at samba.org
Mon Mar 4 16:50:02 GMT 2002


On Mon, Mar 04, 2002 at 03:56:14PM -0800, Marc Jacobsen wrote:
> I have noticed that the way Samba handles client requested record locks has 
> changed (for the worse IMHO) as of Samba 2.2.0.  Often when a client requests an 
> exclusive (read-write) record lock, a shared (read-only) UNIX byte range lock is 
> created, while with Samba 2.0.X a more appropriate exclusive (read-write) UNIX 
> byte range lock was created.  This causes big problems with locking integration 
> between UNIX/NFS and CIFS clients (the CIFS client expects that nobody else can 
> read, but UNIX processes and NFS clients can).
> 
> This is due to the fact that with Samba 2.0.X files were always opened 
> read-write (if at all possible), but as of Samba 2.2.0 files are not always 
> opened as read-write.  Thus files are often opened read-only, causing exclusive 
> record locks to be mapped to shared UNIX byte range locks (see the 
> map_posix_lock_type() function in source/locking/locking.c).
> 
> This could happen in some situations with Samba 2.0.X, but happens much more 
> often on Samba 2.2.X.  My question is if this was known, expected and deemed 
> acceptable, or is this behavior a surprise and considered to be a bug that needs 
> to be fixed?

Expected side-effect with the change to doing opens as the
client desires. No way to fix this (as POSIX doesn't allow
r/w locks on a r/o file).

Jeremy.




More information about the samba-technical mailing list