[Samba] A samba locking question

Patrik Gustavsson Patrik.Gustavsson at Sun.COM
Wed Feb 11 13:11:07 GMT 2004


Let me the try to communicate in a different way.

The only thing I want to know if byte range locks
or file share reservation are propagated to or from UNIX.

That is:

a) When a external program is doing a byte range lock through
   fcntl on file, will that be checked before Samba is 
   opening the file ?

   My findings tells me it does.


b) When a external program is doing file share reservation
   through on a file fcntl will that be checked before Samba is opening
   the file ?

   My findings tells me it don't.
 
   The test-program did file share reservation through fcntl on file
   with the parameters:
	f_access=F_RWACC (Set a  file  share  reservation  for  read 
		          and  write access)
	f_deny=F_RWDNY   (Set a file share reservation to deny  read 
			  and  write)

   The client could through Samba open and write in that file.

c) If/When Samba is doing a byte range lock on file will that byte
   range lock be propagated externaly to UNIX ?

   I believe it will not.

d) If/When Samba is doing a file share reservation on file will that
   be propagated externaly to UNIX ?

   My findings tells me it don't.


I don't this good or bad. I just want to know.

/Patrik



On Tue, 2004-02-10 at 19:18, Jeremy Allison wrote:
> On Tue, Feb 10, 2004 at 09:39:01AM +0100, Patrik Gustavsson wrote:
> > Well, you should know.
> > 
> > But if Samba is doing byte ranged lock using fcntl, then
> > I don't understand why my tests failed.
> > 
> > The first test I did was:
> > 
> > I simulated a NFS client and did byte range lock on a file,
> > a document in this case 8K in size, and tried to open that from
> > client using Samba and it failed becuse is was locked.
> > 
> > The second test I did was:
> > 
> > When  a client opened the file using samba, with a
> > DENY_WRITE lock (output from smbstatus) and I used the same simulated
> > NFS client that did a byte range write lock using fcntl() on that
> > document.
> > I would assume that the byte range lock would fail, but it didn't it 
> > succeeded.
> > 
> > That surprised me.
> 
> You're confusing share modes with byte range locks. Read up on share
> modes - smbstatus doesn't report byte range locks, only share modes.
> 
> Until you understand the difference we're not really communicating :-). At all :-).
> 
> Jeremy.
-- 
"In a world without fences who needs Gates"
Patrik Gustavsson, Senior Technical Consultant
patrik.gustavsson at sun.com     Telephone: +46 60 671540
http://glen.sweden            Mobile: +46 70 3551040
SUN MICROSYSTEMS              Fax: +46 60 671550
--------------------------------------------------------------




More information about the samba mailing list