record locking behavior

Marc Jacobsen Marc_Jacobsen at
Mon Mar 4 16:04:05 GMT 2002

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?

Marc Jacobsen

More information about the samba-technical mailing list