reply_read_and_X and is_locked

Peter Godman pete at isilon.com
Tue Mar 4 15:49:56 GMT 2003


Hello Samba Hackers!

I am debugging a performance problem associated with backing samba with a
distributed filesystem.  On this filesystem, querying whether a file is
locked may involve a network roundtrip.  Locking a file is substantially
less likely to involve a roundtrip, at least if the file is locked and
unlocked repeatedly.

I'd like to ask a question about the following code in read_and_reply_X:

	if(is_locked(fsp,conn,(SMB_BIG_UINT)smb_maxcnt,(SMB_BIG_UINT)startpos,READ_LOCK,False)) {
		END_PROFILE(SMBreadX);
		return ERROR_DOS(ERRDOS,ERRlock);
	}

So if I understand this correctly, we wish to fail the request if someone
has an exclusive lock on this region of the file (please correct me if I'm
wrong).  However, this seems wrong, in that there is a race here.  Why is
it in this case that for the duration of the read we don't acquire a read
lock on this region of the file?  Or do we?  Maybe I'm missing something
here (?) :)

Cheers,
Peter Godman




More information about the samba-technical mailing list