[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Mon Sep 9 15:43:02 UTC 2019


The branch, master has been updated
       via  2b43ce6704e s3:selftest: add delay_inject:brl_lock_windows testing
       via  c2503a5c68e vfs_delay_inject: add support for brl_[un]lock_windows()
       via  66d92f37c3a s3:locking: add brl_req_guid() and brl_req_mem_ctx() helper functions
       via  7471b0f6327 s3:smb2_lock: handle NT_STATUS_RETRY from the VFS backend
       via  7d1cd6f22e7 s3:blocking: handle NT_STATUS_RETRY from the VFS backend
       via  8975673e3c3 s3:blocking: make use of smbd_smb1_do_locks_try() in smbd_smb1_do_locks_send()
       via  6e30a89b3f0 s3:blocking: call smbd_smb1_do_locks_setup_timeout() also in smbd_smb1_do_locks_try()
       via  31232710627 s3:blocking: fix the fsp->blocked_smb1_lock_reqs handling
       via  997548a5f1a s3:blocking: do the timeout calculation before calling dbwrap_watched_watch_send()
       via  8da7c10a582 s3:blocking: split out smbd_smb1_do_locks_setup_timeout()
       via  5a841a43f9c s3:blocking: use timeval_expired(&state->endtime) to stop processing
       via  d3bc0199697 s4:torture/raw: add multilock6 test
       via  6d4296aca0c s4:torture/raw: add multilock5 test
       via  d3e65ceb1ec s4:torture/raw: add multilock4 test
       via  297763c6b61 s4:torture/raw: add multilock3 test
       via  8a7039be530 s4:torture/raw: improvements for multilock2
       via  8decf41bbb8 s3:smb2_lock: add retry for POSIX locks
       via  7155d3a2c5d s4:torture/smb2: add smb2.samba3misc.localposixlock1
       via  359e9992be7 s3:smb2_lock: make use of smbd_smb2_lock_try() in smbd_smb2_lock_send()
       via  7f77e0b4e98 s3:smb2_lock: let smbd_smb2_lock_try() explicitly check for the retry condition
       via  39d514cdc35 s3:smb2_lock: error out early in smbd_smb2_lock_send()
       via  d096742da1a s3:smb2_lock: split smbd_smb2_lock_retry() into _try() and _retry()
       via  f13d13ae9da s3:smb2_lock: move from 'blocking' to 'state->blocking'
       via  ad98eec6090 s3:brlock: always return LOCK_NOT_GRANTED instead of FILE_LOCK_CONFLICT
       via  aba0ee46258 s3:blocking: maintain state->deny_status
       via  2a77025a1e1 s4:torture/raw: assert to get LOCK_NOT_GRANTED in torture_samba3_posixtimedlock()
       via  15765644d25 s3:blocking: use dynamic posix lock wait intervals
       via  62ec58b06c3 s3:blocking: Remove bug reproducer from a few commits ago
       via  e8d719d31f8 s3:blocking: fix posix lock retry
       via  8fe708acb43 s3:blocking: move from 'timeout' to 'smbd_smb1_do_locks_state->timeout'
       via  e79fcfaaf2e s3:blocking: split smbd_smb1_do_locks_retry() into _try() and _retry()
       via  2ec9e93a7aa s3:blocking: demonstrate the posix lock retry fails
       via  ac28eec3e4a s3:torture: convert LOCK9 into LOCK9A and LOCK9B
       via  e18c8ced8e7 s3:torture: fix the timeout alarm handling on LOCK9
       via  3b788d97f99 s3:blocking: remove unused timeval_brl_min()
       via  bd8884e5722 s3:locking: add share_mode_wakeup_waiters() helper function
       via  0e5613e39d6 s3:locking: add/split out byte_range_{valid,overlap}() helper functions
       via  8b565de1acb s3:smb2_lock: call change_to_user_by_fsp() when dbwrap_watched_watch* finishes
       via  28ac2cbaf92 s3:blocking: call change_to_user_by_fsp() when dbwrap_watched_watch* finishes
       via  bebee47e638 s4:torture: make rpc.handles.random-assoc test more robust
      from  560c3abf453 s3:smbcontrol: avoid printing NULL help strings

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 2b43ce6704ecf035e6734337a2dea3458153a4b2
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Aug 20 15:53:59 2019 +0200

    s3:selftest: add delay_inject:brl_lock_windows testing
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(master): Mon Sep  9 15:42:45 UTC 2019 on sn-devel-184

commit c2503a5c68e967054ab84ca0d8ce693200c2e002
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Aug 19 18:22:38 2019 +0200

    vfs_delay_inject: add support for brl_[un]lock_windows()
    
    This demonstrates the two ways to handle the retry:
    - smb layer retry => plock->context.smblctx = UINT64_MAX
    - vfs backend retry => plock->context.smblctx = 0
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 66d92f37c3a643d97489a59bb6d1e75e91528c20
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Aug 8 19:26:28 2019 +0200

    s3:locking: add brl_req_guid() and brl_req_mem_ctx() helper functions
    
    This allows the vfs backend to detect a retry and keep state between
    the retries.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 7471b0f63276e707784c98b832992ff08b1898ef
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Aug 19 16:25:59 2019 +0200

    s3:smb2_lock: handle NT_STATUS_RETRY from the VFS backend
    
    This allows the VFS backends to implement async byte
    range locking.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 7d1cd6f22e7e3d95aba04c45776057945c2a5e30
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Aug 19 15:29:32 2019 +0200

    s3:blocking: handle NT_STATUS_RETRY from the VFS backend
    
    This allows the VFS backends to implement async byte
    range locking.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 8975673e3c3f9f7dbdb7ba7562bb81a62cd24e2e
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Aug 15 20:09:55 2019 +0200

    s3:blocking: make use of smbd_smb1_do_locks_try() in smbd_smb1_do_locks_send()
    
    We only need the logic to call smbd_smb1_do_locks_check() and a possible
    retry once in smbd_smb1_do_locks_try().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 6e30a89b3f00ad55391454fbaa1272074e1962f0
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Aug 15 18:18:50 2019 +0200

    s3:blocking: call smbd_smb1_do_locks_setup_timeout() also in smbd_smb1_do_locks_try()
    
    This is a noop if smbd_smb1_do_locks_setup_timeout() was called before.
    
    But it allows us to use smbd_smb1_do_locks_try() in
    smbd_smb1_do_locks_send() in a following commit.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 312327106271abafeb53e62dfb71a38bf93e2d41
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Aug 16 14:55:13 2019 +0200

    s3:blocking: fix the fsp->blocked_smb1_lock_reqs handling
    
    A new request is first checks against all pending
    requests before checking the already granted locks.
    
    Before we retried the lock array of another request
    (the first in the list), but then finished current request,
    which is wrong.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 997548a5f1a14d82f1e80cce6d9ee55e85b5107c
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Aug 19 15:21:50 2019 +0200

    s3:blocking: do the timeout calculation before calling dbwrap_watched_watch_send()
    
    This makes the next commits easier to understand.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 8da7c10a58292022ee57406db9a365de9ffaf5cf
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Aug 15 18:02:57 2019 +0200

    s3:blocking: split out smbd_smb1_do_locks_setup_timeout()
    
    This function can be called multiple times, but only
    the first time will setup the endtime. And the
    endtime is relative to the request time and not
    the current time.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 5a841a43f9c4f862e2d7235429363b3066cf5850
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Aug 15 18:17:47 2019 +0200

    s3:blocking: use timeval_expired(&state->endtime) to stop processing
    
    This is less racy than timeval_elapsed() > 0
    as the current time is already expired and timeout = 0
    will always work correct.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit d3bc0199697fd7d6e04479321ca644a227bc4ede
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Aug 16 16:24:34 2019 +0200

    s4:torture/raw: add multilock6 test
    
    This is similar to multilock3, but uses a read-only
    (LOCKING_ANDX_SHARED_LOCK) locks for the 2nd lock
    request.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 6d4296aca0c9a9287c0c78c8f8847a560bd2ea24
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Aug 16 15:12:01 2019 +0200

    s4:torture/raw: add multilock5 test
    
    This is similar to multilock3, but uses a read-only
    (LOCKING_ANDX_SHARED_LOCK) locks for the first lock
    request.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit d3e65ceb1ec25c7b62a7e908506126269011f30d
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Aug 16 14:49:29 2019 +0200

    s4:torture/raw: add multilock4 test
    
    This is similar to multilock3, but uses read-only
    (LOCKING_ANDX_SHARED_LOCK) locks for the blocked
    requests.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 297763c6b618c07148d788b46218a0798225bf79
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Aug 16 12:13:15 2019 +0200

    s4:torture/raw: add multilock3 test
    
    This demonstrates that unrelated lock ranges
    are not blocked by other blocked requests on the same
    fsp.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 8a7039be530adcdda9e7e7621bdcf902f5ca1721
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Aug 16 12:28:39 2019 +0200

    s4:torture/raw: improvements for multilock2
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 8decf41bbb8be2b4ac463eb6ace16a8628276ab5
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Aug 2 14:50:27 2019 +0200

    s3:smb2_lock: add retry for POSIX locks
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 7155d3a2c5d7237f00cccb1802c1341cf295864e
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Aug 19 17:38:30 2019 +0200

    s4:torture/smb2: add smb2.samba3misc.localposixlock1
    
    This demonstrates that the SMB2 code path doesn't do
    any retry for local posix locks.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 359e9992be713bbecfdb19998d69e1d3f020c5e9
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Aug 13 16:39:41 2019 +0200

    s3:smb2_lock: make use of smbd_smb2_lock_try() in smbd_smb2_lock_send()
    
    We only need the logic to call smbd_do_locks_try() and a possible
    retry once in smbd_smb2_lock_try().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 7f77e0b4e9878f1f3515206d052adc012e26aafb
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Aug 13 16:39:41 2019 +0200

    s3:smb2_lock: let smbd_smb2_lock_try() explicitly check for the retry condition
    
    This makes it possible to reuse _try() in the _send() function in the
    next commit.
    
    We should not retry forever on a hard error.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 39d514cdc358f175d0968f4a78f8f2f05a6c1707
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Aug 13 16:39:41 2019 +0200

    s3:smb2_lock: error out early in smbd_smb2_lock_send()
    
    We no longer expect NT_STATUS_FILE_LOCK_CONFLICT from
    the VFS layer and assert that in a future version.
    
    This makes it easier to port the same logic to smbd_smb2_lock_try().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit d096742da1a045357f52ccd5b28d499c30e96152
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Aug 13 16:39:41 2019 +0200

    s3:smb2_lock: split smbd_smb2_lock_retry() into _try() and _retry()
    
    This makes it possible to reuse _try() in the _send() function in the
    next commits.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit f13d13ae9da3072862a781bc926e7a06e8384337
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Aug 13 16:14:23 2019 +0200

    s3:smb2_lock: move from 'blocking' to 'state->blocking'
    
    This will simplify the next commits.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit ad98eec6090430ba5296a5111dde2e53b9cd217a
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Aug 19 12:33:28 2019 +0200

    s3:brlock: always return LOCK_NOT_GRANTED instead of FILE_LOCK_CONFLICT
    
    Returning NT_STATUS_FILE_LOCK_CONFLICT is a SMB1 only detail
    for delayed brlock requests, which is handled in
    smbd_smb1_do_locks*().
    
    The brlock layer should be consistent even for posix locks.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Signed-off-by: Volker Lendecke <vl at samba.org>

commit aba0ee46258f3dd910421facb742fce3318a6946
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Aug 19 12:04:43 2019 +0200

    s3:blocking: maintain state->deny_status
    
    For Windows locks we start with LOCK_NOT_GRANTED and use
    FILE_LOCK_CONFLICT if we retried after a timeout.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 2a77025a1e16d897281e5840192c93fa03328681
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Aug 19 16:30:16 2019 +0200

    s4:torture/raw: assert to get LOCK_NOT_GRANTED in torture_samba3_posixtimedlock()
    
    There should not be a different if the blocker is a posix process
    instead of another smbd.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 15765644d2590d6549f8fcc01c39c56387eed654
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Aug 15 17:26:43 2019 +0200

    s3:blocking: use dynamic posix lock wait intervals
    
    We want to start with a short timeout (200ms) and
    slow down to larger timeouts up to 2s for the default
    value of "lock spin time".
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 62ec58b06c38ee82bb3147c4d325413fd3a76499
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Aug 15 16:44:11 2019 +0200

    s3:blocking: Remove bug reproducer from a few commits ago
    
    The problem is fixed, now we can revert the change that made it
    easier to trigger.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit e8d719d31f885d7b6d5b317165f90ec40df169c9
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Aug 15 14:21:38 2019 +0200

    s3:blocking: fix posix lock retry
    
    We should evaluate the timeout condition after the very last
    retry and not before.
    
    Otherwise we'd fail to retry when waiting for posix locks.
    The problem happens if the client provided timeout is smaller
    than the 1 sec (for testing temporary 15 secs) retry.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 8fe708acb43ea36d0cbf398713b125daba180a2d
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Aug 13 18:34:36 2019 +0200

    s3:blocking: move from 'timeout' to 'smbd_smb1_do_locks_state->timeout'
    
    This will make it possible to just use smbd_smb1_do_locks_try()
    in a later commit.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit e79fcfaaf2ecfca6c3747f6fe4be51f332ebf10d
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Aug 13 18:34:36 2019 +0200

    s3:blocking: split smbd_smb1_do_locks_retry() into _try() and _retry()
    
    This will make it possible to have just one caller to
    smbd_do_locks_try() later and use smbd_smb1_do_locks_try()
    from within smbd_smb1_do_locks_send().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 2ec9e93a7aac2706b4a5931495d56a7b64f8d894
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Aug 15 11:09:47 2019 +0200

    s3:blocking: demonstrate the posix lock retry fails
    
    This is just a temporary commit that shows the bug and its
    fix. It will be reverted once the problem is fixed.
    
    The posix lock retry fails if the client specified timeout
    is smaller than the hardcoded 1 second retry.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit ac28eec3e4af710feab3be3d4b25bfbe38294431
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Aug 15 14:31:54 2019 +0200

    s3:torture: convert LOCK9 into LOCK9A and LOCK9B
    
    LOCK9A is the original test (with a timeout of -1)
    and LOCK9B is the same but with timeout of 10 seconds.
    
    LOCK9B is needed to demonstrate a server bug in the next
    commits.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit e18c8ced8e7a872deb118191595425ef6b826bfa
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Aug 15 16:10:58 2019 +0200

    s3:torture: fix the timeout alarm handling on LOCK9
    
    smbXcli_conn_disconnect(alarm_cli->conn, NT_STATUS_OK)
    means existing requests are not finished with an error,
    but instead just keep dangling arround.
    
    Pass NT_STATUS_LOCAL_DISCONNECT in order to fail the
    cli_lock32() call after getting SIGALARM.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 3b788d97f9995e24e4005567f90a925957fb1e00
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Aug 13 19:19:07 2019 +0200

    s3:blocking: remove unused timeval_brl_min()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit bd8884e5722cbbb7783fb4ae53e4f35b31031b01
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Aug 9 00:47:39 2019 +0200

    s3:locking: add share_mode_wakeup_waiters() helper function
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 0e5613e39d6c6bb892fed939c63b4f14b878803b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Sep 5 08:43:32 2019 +0200

    s3:locking: add/split out byte_range_{valid,overlap}() helper functions
    
    They implement the logic from [MS-FSA].
    
    The following commits will use these functions in other locations.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 8b565de1acb0fda121cb0bd4cff42d66ee027529
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Sep 4 12:47:07 2019 +0200

    s3:smb2_lock: call change_to_user_by_fsp() when dbwrap_watched_watch* finishes
    
    This is not strictly required as fd-based calls are used,
    but it's more consistent to call SMB_VFS_BRL_LOCK_WINDOWS()
    in the same environment on retry.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 28ac2cbaf92a8619f0380f024c5a220d9fdc4622
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Sep 4 12:50:06 2019 +0200

    s3:blocking: call change_to_user_by_fsp() when dbwrap_watched_watch* finishes
    
    This is not strictly required as fd-based calls are used,
    but it's more consistent to call SMB_VFS_BRL_LOCK_WINDOWS()
    in the same environment on retry.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit bebee47e6386476e9948089484f89d213fcc2660
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Aug 16 12:50:21 2019 +0200

    s4:torture: make rpc.handles.random-assoc test more robust
    
    We've seen failures like this:
    
      RPC-HANDLE-RANDOM-ASSOC
      connect samr pipe1
      pipe1 uses assoc_group_id[0x00000001]
      connect samr pipe2 with assoc_group_id[0xFFFFFFFF]- should fail
      Failed to bind to uuid 12345778-1234-abcd-ef00-0123456789ac for
        ncacn_np:localdc[\pipe\samr,bigendian,assoc_group_id=0xffffffff,
        abstract_syntax=12345778-1234-abcd-ef00-0123456789ac/0x00000001] NT_STATUS_UNSUCCESSFUL
      connect samr pipe3 with assoc_group_id[0x00000000]- should fail
      UNEXPECTED(failure): samba4.rpc.handles on ncacn_np with bigendian.random-assoc(ad_dc_default)
      REASON: Exception: Exception: ../../source4/torture/rpc/handles.c:546:
        status was NT_STATUS_OK, expected NT_STATUS_UNSUCCESSFUL: opening samr pipe3
    
    Prevent that it wraps to 0x00000000
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 selftest/knownfail                 |    1 +
 selftest/skip                      |    3 +-
 selftest/target/Samba3.pm          |   12 +
 source3/include/locking.h          |    2 +
 source3/locking/brlock.c           |  162 +++++-
 source3/locking/locking.c          |   11 +-
 source3/locking/proto.h            |   15 +
 source3/locking/share_mode_lock.c  |   12 +
 source3/modules/vfs_delay_inject.c |  117 ++++
 source3/modules/vfs_fruit.c        |   13 +
 source3/selftest/tests.py          |    9 +-
 source3/smbd/blocking.c            |  545 ++++++++++++------
 source3/smbd/globals.c             |   18 +
 source3/smbd/globals.h             |    2 +
 source3/smbd/proto.h               |    4 +-
 source3/smbd/reply.c               |    7 +
 source3/smbd/smb2_lock.c           |  243 ++++++--
 source3/smbd/trans2.c              |    2 +
 source3/torture/torture.c          |   40 +-
 source4/torture/raw/lock.c         | 1069 +++++++++++++++++++++++++++++++++++-
 source4/torture/raw/samba3misc.c   |    6 +-
 source4/torture/rpc/handles.c      |    4 +-
 source4/torture/smb2/samba3misc.c  |  188 +++++++
 source4/torture/smb2/smb2.c        |    1 +
 source4/torture/smb2/wscript_build |    1 +
 25 files changed, 2235 insertions(+), 252 deletions(-)
 create mode 100644 source4/torture/smb2/samba3misc.c


Changeset truncated at 500 lines:

diff --git a/selftest/knownfail b/selftest/knownfail
index ded80b12259..7b54b77a708 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -109,6 +109,7 @@
 .*net.api.delshare.*				# DelShare isn't implemented yet
 ^samba4.smb2.oplock.doc
 ^samba4.smb2.lock.valid-request
+^samba4.raw.lock.multilock6.ad_dc_ntvfs
 ^samba4.ldap.python \(ad_dc_default\).Test add_ldif\(\) with BASE64 security descriptor input using WRONG domain SID\(.*\)$
 ^samba4.raw.lock.*.async # bug 6960
 ^samba4.raw.open.ntcreatex_supersede
diff --git a/selftest/skip b/selftest/skip
index 1e7448acb9f..11bf29599fa 100644
--- a/selftest/skip
+++ b/selftest/skip
@@ -34,7 +34,7 @@
 ^samba3.smbtorture_s3.*.pipe_number
 ^samba3.smbtorture_s3.LOCAL-DBTRANS #hangs for some reason
 ^samba3.smbtorture_s3.*.DIR1 #loops on 64 bit linux with ext4
-^samba3.smbtorture_s3.plain.LOCK9\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server
+^samba3.smbtorture_s3.plain.LOCK9.*\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server
 ^samba3.smbtorture_s3.plain.OPLOCK2\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server
 ^samba3.smbtorture_s3.plain.STREAMERROR\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server
 ^samba3.smbtorture_s3.plain.DIR1\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server
@@ -93,6 +93,7 @@
 ^samba4.rpc.samr.passwords.*ncacn_np\(ad_dc_slowtests\) # currently fails, possibly config issue
 ^samba4.rpc.samr.passwords.*s4member       # currently fails, possibly config issue
 ^samba4.raw.scan.eamax
+^samba4.smb2.samba3misc
 ^samba4.smb2.notify
 ^samba4.smb2.scan
 ^samba4.smb2.lease
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 1dfd543d6b5..7c9fdfc6889 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -2272,6 +2272,18 @@ sub provision($$$$$$$$$)
 	delay_inject:pread_send = 2000
 	delay_inject:pwrite_send = 2000
 
+[brl_delay_inject1]
+	copy = tmp
+	vfs objects = delay_inject
+	delay_inject:brl_lock_windows = 90
+	delay_inject:brl_lock_windows_use_timer = yes
+
+[brl_delay_inject2]
+	copy = tmp
+	vfs objects = delay_inject
+	delay_inject:brl_lock_windows = 90
+	delay_inject:brl_lock_windows_use_timer = no
+
 [delete_readonly]
 	path = $prefix_abs/share
 	delete readonly = yes
diff --git a/source3/include/locking.h b/source3/include/locking.h
index 3e7560bef9e..0175db2dd47 100644
--- a/source3/include/locking.h
+++ b/source3/include/locking.h
@@ -30,6 +30,7 @@ enum brl_type {READ_LOCK, WRITE_LOCK, UNLOCK_LOCK};
 enum brl_flavour {WINDOWS_LOCK = 0, POSIX_LOCK = 1};
 
 #include "librpc/gen_ndr/server_id.h"
+#include "librpc/gen_ndr/misc.h"
 
 /* This contains elements that differentiate locks. The smbpid is a
    client supplied pid, and is essentially the locking context for
@@ -62,6 +63,7 @@ struct lock_struct {
 };
 
 struct smbd_lock_element {
+	struct GUID req_guid;
 	uint64_t smblctx;
 	enum brl_type brltype;
 	uint64_t offset;
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index cdfd09ceff1..f22580164f9 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -46,6 +46,8 @@ static struct db_context *brlock_db;
 
 struct byte_range_lock {
 	struct files_struct *fsp;
+	TALLOC_CTX *req_mem_ctx;
+	const struct GUID *req_guid;
 	unsigned int num_locks;
 	bool modified;
 	struct lock_struct *lock_data;
@@ -84,6 +86,25 @@ struct files_struct *brl_fsp(struct byte_range_lock *brl)
 	return brl->fsp;
 }
 
+TALLOC_CTX *brl_req_mem_ctx(const struct byte_range_lock *brl)
+{
+	if (brl->req_mem_ctx == NULL) {
+		return talloc_get_type_abort(brl, struct byte_range_lock);
+	}
+
+	return brl->req_mem_ctx;
+}
+
+const struct GUID *brl_req_guid(const struct byte_range_lock *brl)
+{
+	if (brl->req_guid == NULL) {
+		static const struct GUID brl_zero_req_guid;
+		return &brl_zero_req_guid;
+	}
+
+	return brl->req_guid;
+}
+
 /****************************************************************************
  See if two locking contexts are equal.
 ****************************************************************************/
@@ -96,6 +117,92 @@ static bool brl_same_context(const struct lock_context *ctx1,
 		(ctx1->tid == ctx2->tid));
 }
 
+bool byte_range_valid(uint64_t ofs, uint64_t len)
+{
+	uint64_t max_len = UINT64_MAX - ofs;
+	uint64_t effective_len;
+
+	/*
+	 * [MS-FSA] specifies this:
+	 *
+	 * If (((FileOffset + Length - 1) < FileOffset) && Length != 0) {
+	 *   return STATUS_INVALID_LOCK_RANGE
+	 * }
+	 *
+	 * We avoid integer wrapping and calculate
+	 * max and effective len instead.
+	 */
+
+	if (len == 0) {
+		return true;
+	}
+
+	effective_len = len - 1;
+	if (effective_len <= max_len) {
+		return true;
+	}
+
+	return false;
+}
+
+bool byte_range_overlap(uint64_t ofs1,
+			uint64_t len1,
+			uint64_t ofs2,
+			uint64_t len2)
+{
+	uint64_t last1;
+	uint64_t last2;
+	bool valid;
+
+	/*
+	 * This is based on [MS-FSA] 2.1.4.10
+	 * Algorithm for Determining If a Range Access
+	 * Conflicts with Byte-Range Locks
+	 */
+
+	/*
+	 * The {0, 0} range doesn't conflict with any byte-range lock
+	 */
+	if (ofs1 == 0 && len1 == 0) {
+		return false;
+	}
+	if (ofs2 == 0 && len2 == 0) {
+		return false;
+	}
+
+	/*
+	 * The caller should have checked that the ranges are
+	 * valid. But currently we gracefully handle
+	 * the overflow of a read/write check.
+	 */
+	valid = byte_range_valid(ofs1, len1);
+	if (valid) {
+		last1 = ofs1 + len1 - 1;
+	} else {
+		last1 = UINT64_MAX;
+	}
+	valid = byte_range_valid(ofs2, len2);
+	if (valid) {
+		last2 = ofs2 + len2 - 1;
+	} else {
+		last2 = UINT64_MAX;
+	}
+
+	/*
+	 * If one range starts after the last
+	 * byte of the other range there's
+	 * no conflict.
+	 */
+	if (ofs1 > last2) {
+		return false;
+	}
+	if (ofs2 > last1) {
+		return false;
+	}
+
+	return true;
+}
+
 /****************************************************************************
  See if lck1 and lck2 overlap.
 ****************************************************************************/
@@ -103,20 +210,10 @@ static bool brl_same_context(const struct lock_context *ctx1,
 static bool brl_overlap(const struct lock_struct *lck1,
                         const struct lock_struct *lck2)
 {
-	/* XXX Remove for Win7 compatibility. */
-	/* this extra check is not redundant - it copes with locks
-	   that go beyond the end of 64 bit file space */
-	if (lck1->size != 0 &&
-	    lck1->start == lck2->start &&
-	    lck1->size == lck2->size) {
-		return True;
-	}
-
-	if (lck1->start >= (lck2->start+lck2->size) ||
-	    lck2->start >= (lck1->start+lck1->size)) {
-		return False;
-	}
-	return True;
+	return byte_range_overlap(lck1->start,
+				  lck1->size,
+				  lck2->start,
+				  lck2->size);
 }
 
 /****************************************************************************
@@ -336,11 +433,12 @@ NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck,
 	files_struct *fsp = br_lck->fsp;
 	struct lock_struct *locks = br_lck->lock_data;
 	NTSTATUS status;
+	bool valid;
 
 	SMB_ASSERT(plock->lock_type != UNLOCK_LOCK);
 
-	if ((plock->start + plock->size - 1 < plock->start) &&
-			plock->size != 0) {
+	valid = byte_range_valid(plock->start, plock->size);
+	if (!valid) {
 		return NT_STATUS_INVALID_LOCK_RANGE;
 	}
 
@@ -385,7 +483,7 @@ NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck,
 			plock->context.smblctx = 0xFFFFFFFFFFFFFFFFLL;
 
 			if (errno_ret == EACCES || errno_ret == EAGAIN) {
-				status = NT_STATUS_FILE_LOCK_CONFLICT;
+				status = NT_STATUS_LOCK_NOT_GRANTED;
 				goto fail;
 			} else {
 				status = map_nt_error_from_unix(errno);
@@ -752,7 +850,7 @@ static NTSTATUS brl_lock_posix(struct byte_range_lock *br_lck,
 				TALLOC_FREE(tp);
 				/* Remember who blocked us. */
 				plock->context.smblctx = curr_lock->context.smblctx;
-				return NT_STATUS_FILE_LOCK_CONFLICT;
+				return NT_STATUS_LOCK_NOT_GRANTED;
 			}
 			/* Just copy the Windows lock into the new array. */
 			memcpy(&tp[count], curr_lock, sizeof(struct lock_struct));
@@ -772,7 +870,7 @@ static NTSTATUS brl_lock_posix(struct byte_range_lock *br_lck,
 				TALLOC_FREE(tp);
 				/* Remember who blocked us. */
 				plock->context.smblctx = curr_lock->context.smblctx;
-				return NT_STATUS_FILE_LOCK_CONFLICT;
+				return NT_STATUS_LOCK_NOT_GRANTED;
 			}
 
 			/* Work out overlaps. */
@@ -835,7 +933,7 @@ static NTSTATUS brl_lock_posix(struct byte_range_lock *br_lck,
 
 			if (errno_ret == EACCES || errno_ret == EAGAIN) {
 				TALLOC_FREE(tp);
-				status = NT_STATUS_FILE_LOCK_CONFLICT;
+				status = NT_STATUS_LOCK_NOT_GRANTED;
 				goto fail;
 			} else {
 				TALLOC_FREE(tp);
@@ -1746,6 +1844,25 @@ struct byte_range_lock *brl_get_locks(TALLOC_CTX *mem_ctx, files_struct *fsp)
 	return br_lck;
 }
 
+struct byte_range_lock *brl_get_locks_for_locking(TALLOC_CTX *mem_ctx,
+						  files_struct *fsp,
+						  TALLOC_CTX *req_mem_ctx,
+						  const struct GUID *req_guid)
+{
+	struct byte_range_lock *br_lck = NULL;
+
+	br_lck = brl_get_locks(mem_ctx, fsp);
+	if (br_lck == NULL) {
+		return NULL;
+	}
+	SMB_ASSERT(req_mem_ctx != NULL);
+	br_lck->req_mem_ctx = req_mem_ctx;
+	SMB_ASSERT(req_guid != NULL);
+	br_lck->req_guid = req_guid;
+
+	return br_lck;
+}
+
 struct brl_get_locks_readonly_state {
 	TALLOC_CTX *mem_ctx;
 	struct byte_range_lock **br_lock;
@@ -1807,14 +1924,11 @@ struct byte_range_lock *brl_get_locks_readonly(files_struct *fsp)
 		/*
 		 * No locks on this file. Return an empty br_lock.
 		 */
-		br_lock = talloc(fsp, struct byte_range_lock);
+		br_lock = talloc_zero(fsp, struct byte_range_lock);
 		if (br_lock == NULL) {
 			return NULL;
 		}
 
-		br_lock->num_locks = 0;
-		br_lock->lock_data = NULL;
-
 	} else if (!NT_STATUS_IS_OK(status)) {
 		DEBUG(3, ("Could not parse byte range lock record: "
 			  "%s\n", nt_errstr(status)));
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 113f63476e4..3ed63cdec41 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -232,6 +232,8 @@ static void decrement_current_lock_count(files_struct *fsp,
 
 struct do_lock_state {
 	struct files_struct *fsp;
+	TALLOC_CTX *req_mem_ctx;
+	const struct GUID *req_guid;
 	uint64_t smblctx;
 	uint64_t count;
 	uint64_t offset;
@@ -251,7 +253,10 @@ static void do_lock_fn(
 	struct do_lock_state *state = private_data;
 	struct byte_range_lock *br_lck = NULL;
 
-	br_lck = brl_get_locks(talloc_tos(), state->fsp);
+	br_lck = brl_get_locks_for_locking(talloc_tos(),
+					   state->fsp,
+					   state->req_mem_ctx,
+					   state->req_guid);
 	if (br_lck == NULL) {
 		state->status = NT_STATUS_NO_MEMORY;
 		return;
@@ -272,6 +277,8 @@ static void do_lock_fn(
 }
 
 NTSTATUS do_lock(files_struct *fsp,
+		 TALLOC_CTX *req_mem_ctx,
+		 const struct GUID *req_guid,
 		 uint64_t smblctx,
 		 uint64_t count,
 		 uint64_t offset,
@@ -282,6 +289,8 @@ NTSTATUS do_lock(files_struct *fsp,
 {
 	struct do_lock_state state = {
 		.fsp = fsp,
+		.req_mem_ctx = req_mem_ctx,
+		.req_guid = req_guid,
 		.smblctx = smblctx,
 		.count = count,
 		.offset = offset,
diff --git a/source3/locking/proto.h b/source3/locking/proto.h
index 53688cb52df..bc53edaec12 100644
--- a/source3/locking/proto.h
+++ b/source3/locking/proto.h
@@ -30,6 +30,14 @@ void brl_shutdown(void);
 
 unsigned int brl_num_locks(const struct byte_range_lock *brl);
 struct files_struct *brl_fsp(struct byte_range_lock *brl);
+TALLOC_CTX *brl_req_mem_ctx(const struct byte_range_lock *brl);
+const struct GUID *brl_req_guid(const struct byte_range_lock *brl);
+
+bool byte_range_valid(uint64_t ofs, uint64_t len);
+bool byte_range_overlap(uint64_t ofs1,
+			uint64_t len1,
+			uint64_t ofs2,
+			uint64_t len2);
 
 NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck,
 				  struct lock_struct *plock);
@@ -70,6 +78,10 @@ int brl_forall(void (*fn)(struct file_id id, struct server_id pid,
 			  br_off start, br_off size,
 			  void *private_data),
 	       void *private_data);
+struct byte_range_lock *brl_get_locks_for_locking(TALLOC_CTX *mem_ctx,
+						  files_struct *fsp,
+						  TALLOC_CTX *req_mem_ctx,
+						  const struct GUID *req_guid);
 struct byte_range_lock *brl_get_locks(TALLOC_CTX *mem_ctx,
 					files_struct *fsp);
 struct byte_range_lock *brl_get_locks_readonly(files_struct *fsp);
@@ -94,6 +106,8 @@ NTSTATUS query_lock(files_struct *fsp,
 			enum brl_type *plock_type,
 			enum brl_flavour lock_flav);
 NTSTATUS do_lock(files_struct *fsp,
+		 TALLOC_CTX *req_mem_ctx,
+		 const struct GUID *req_guid,
 		 uint64_t smblctx,
 		 uint64_t count,
 		 uint64_t offset,
@@ -132,6 +146,7 @@ NTSTATUS share_mode_do_locked(
 		   bool *modified_dependent,
 		   void *private_data),
 	void *private_data);
+NTSTATUS share_mode_wakeup_waiters(struct file_id id);
 
 struct share_mode_lock *fetch_share_mode_unlocked(TALLOC_CTX *mem_ctx,
 						  struct file_id id);
diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c
index 5c997bd61a0..fada7e5691e 100644
--- a/source3/locking/share_mode_lock.c
+++ b/source3/locking/share_mode_lock.c
@@ -771,6 +771,18 @@ NTSTATUS share_mode_do_locked(
 	return NT_STATUS_OK;
 }
 
+static void share_mode_wakeup_waiters_fn(struct db_record *rec,
+					 bool *modified_dependent,
+					 void *private_data)
+{
+	*modified_dependent = true;
+}
+
+NTSTATUS share_mode_wakeup_waiters(struct file_id id)
+{
+	return share_mode_do_locked(id, share_mode_wakeup_waiters_fn, NULL);
+}
+
 struct fetch_share_mode_unlocked_state {
 	TALLOC_CTX *mem_ctx;
 	struct share_mode_lock *lck;
diff --git a/source3/modules/vfs_delay_inject.c b/source3/modules/vfs_delay_inject.c
index d561fadb03b..569bd40054a 100644
--- a/source3/modules/vfs_delay_inject.c
+++ b/source3/modules/vfs_delay_inject.c
@@ -304,12 +304,129 @@ static ssize_t vfs_delay_inject_pwrite_recv(struct tevent_req *req,
 	return state->ret;
 }
 
+struct vfs_delay_inject_brl_lock_state {
+	struct vfs_delay_inject_brl_lock_state *prev, *next;
+	struct files_struct *fsp;
+	struct GUID req_guid;
+	struct timeval delay_tv;
+	struct tevent_timer *delay_te;
+};
+
+static struct vfs_delay_inject_brl_lock_state *brl_lock_states;
+
+static int vfs_delay_inject_brl_lock_state_destructor(struct vfs_delay_inject_brl_lock_state *state)
+{
+	DLIST_REMOVE(brl_lock_states, state);
+	return 0;
+}
+
+static void vfs_delay_inject_brl_lock_timer(struct tevent_context *ev,
+					    struct tevent_timer *te,
+					    struct timeval current_time,
+					    void *private_data)
+{
+	struct vfs_delay_inject_brl_lock_state *state =
+		talloc_get_type_abort(private_data,
+		struct vfs_delay_inject_brl_lock_state);
+	NTSTATUS status;
+
+	TALLOC_FREE(state->delay_te);
+
+	status = share_mode_wakeup_waiters(state->fsp->file_id);
+	if (!NT_STATUS_IS_OK(status)) {
+		DBG_ERR("share_mode_wakeup_waiters(%s) %s\n",
+			file_id_string_tos(&state->fsp->file_id),
+			nt_errstr(status));
+	}
+}
+
+static NTSTATUS vfs_delay_inject_brl_lock_windows(struct vfs_handle_struct *handle,
+						  struct byte_range_lock *br_lck,
+						  struct lock_struct *plock)
+{
+	struct files_struct *fsp = brl_fsp(br_lck);
+	TALLOC_CTX *req_mem_ctx = brl_req_mem_ctx(br_lck);
+	const struct GUID *req_guid = brl_req_guid(br_lck);
+	struct vfs_delay_inject_brl_lock_state *state = NULL;
+	bool expired;
+
+	for (state = brl_lock_states; state != NULL; state = state->next) {
+		bool match;
+
+		match = GUID_equal(&state->req_guid, req_guid);
+		if (match) {
+			break;
+		}


-- 
Samba Shared Repository



More information about the samba-cvs mailing list