smb_lockingX behaviour in stock 2.2.1

dolze at epcnet.de dolze at epcnet.de
Wed Aug 29 16:42:05 GMT 2001


Hi,

if have seen a very strange behaviour of samba in reply to smb_lockingX and want to know, if it's a feature or a bug. From the CIFS1.0 spec i can read:

"Timeout is the maximum amount of time to wait for the byte range(s) specified to become unlocked.  A timeout value of 0 indicates that the server should fail immediately if any lock range specified is locked. A timeout value of -1 indicates that the server should wait as long as it takes for each byte range specified to become unlocked so that it may be again locked by this protocol.  Any other value of smb_timeout specifies the maximum number of milliseconds to wait for all lock range(s) specified to become available."

And here's a log what stock samba-2.2.1's doing:

First, i lock a range with pid 5525 on file varnus:

[2001/08/29 16:27:34, 10] smbd/reply.c:reply_lockingX(4477)
  reply_lockingX: lock start=0, len=384 for pid 5525, file varnus
[2001/08/29 16:27:34, 10] locking/locking.c:do_lock(118)
  do_lock: lock type WRITE start=0 len=384 requested for file varnus
[2001/08/29 16:27:34, 5] locking/posix.c:set_posix_lock(1037)
  set_posix_lock: File varnus, offset = 0, count = 384, type = WRITE
[2001/08/29 16:27:34, 10] locking/posix.c:posix_lock_in_range(626)
  posix_lock_in_range: offset_out = 0, count_out = 384
[2001/08/29 16:27:34, 10] locking/posix.c:add_posix_lock_entry(391)
  add_posix_lock: File varnus: type = WRITE: start=0 size=384: dev=772 inode=590956
[2001/08/29 16:27:34, 5] locking/posix.c:set_posix_lock(1123)
  set_posix_lock: Real lock: Type = WRITE: offset = 0, count = 384
[2001/08/29 16:27:34, 8] locking/posix.c:posix_fcntl_lock(686)
  posix_fcntl_lock 18 13 0 384 1
[2001/08/29 16:27:34, 8] lib/util.c:fcntl_lock(1313)
  fcntl_lock 18 13 0 384 1
[2001/08/29 16:27:34, 8] lib/util.c:fcntl_lock(1353)
  fcntl_lock: Lock call successful
[2001/08/29 16:27:34, 8] locking/posix.c:posix_fcntl_lock(747)
  posix_fcntl_lock: Lock call successful

It succeeds as expected. Now i want to lock the same region on the file varnus with another process  (pid 5526):

[2001/08/29 16:27:34, 10] smbd/reply.c:reply_lockingX(4477)
  reply_lockingX: lock start=0, len=384 for pid 5526, file varnus
[2001/08/29 16:27:34, 10] locking/locking.c:do_lock(118)
  do_lock: lock type WRITE start=0 len=384 requested for file varnus

Here we can see, "expiry time -1":

[2001/08/29 16:27:34, 3] smbd/blocking.c:push_blocking_lock_request(122)
  push_blocking_lock_request: lock request length=65 blocked with expiry time -1 (+-1) for fnum = 5879, name = varnus
[2001/08/29 16:27:44, 3] smbd/sec_ctx.c:set_sec_ctx(317)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 0
[2001/08/29 16:27:44, 5] smbd/uid.c:unbecome_user(217)
  unbecome_user now uid=(0,0) gid=(0,0)
[2001/08/29 16:27:44, 5] smbd/blocking.c:process_blocking_lock_queue(578)
  process_blocking_lock_queue: examining pending lock fnum = 5879 for file varnus
[2001/08/29 16:27:44, 3] smbd/sec_ctx.c:set_sec_ctx(317)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 0
[2001/08/29 16:27:44, 3] smbd/sec_ctx.c:set_sec_ctx(322)
  7 user groups: 
  0 1 2 3 4 6 10 
[2001/08/29 16:27:44, 5] smbd/uid.c:become_user(203)
  become_user uid=(0,0) gid=(0,0)

Ups (!), after 10 seconds we get an eclass=1, ecode=33 error back:

[2001/08/29 16:27:44, 10] locking/locking.c:do_lock(118)
  do_lock: lock type WRITE start=0 len=384 requested for file varnus
[2001/08/29 16:27:44, 3] smbd/error.c:error_packet(141)
  error packet at line 182 cmd=36 (SMBlockingX) eclass=1 ecode=33

Is 10 seconds "wait as long as it takes for each byte range specified to become unlocked" ?? I know that e.g. Win95 don't wait and return immediately (in my view it's broken there). WinNT4 waits as expected from the CIFS-spec.

Is that fixed in CVS?

Please give me some hint!

Greetings

    Jochen Dolze





More information about the samba-technical mailing list