The branch, master has been updated
       via  6f09b61f0b9 WHATSNEW: SMB3 Directory Leases
       via  14f3f88a3cf smbtorture: Directory Leases vs unlink
       via  d805f6e22f4 smbtorture: Directory Leases vs hardlink
       via  4ed15961d77 smbtorture: Directory Leases vs overwrite
       via  b59a8331079 smbtorture: Directory Leases vs renaming
       via  f95867e8f54 smbtorture: Directory Leases vs setting access date
       via  28e8aae6ad5 smbtorture: Directory Leases vs setting inode change 
date
       via  b277c32dc1d smbtorture: Directory Leases vs setting modification 
date
       via  1150efd21c6 smbtorture: Directory Leases vs setting creation date
       via  aa50c19e6bc smbtorture: Directory Leases vs setting DOS attributes
       via  9b6592d696c smbtorture: Directory Leases vs setting EOF
       via  2f4cd3ab94f libcli/smb: only copy the parent lease key if 
SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET is set
       via  dde84e5fd33 smbtorture: check parent leasekey is ignored unless 
SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET is set
       via  52d8af2f423 libcli/smb: only allow 
SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET in lease_flag
       via  9708aebcce8 smbtorture: check SMB2_LEASE_FLAG_BREAK_IN_PROGRESS 
when client requests new lease
       via  cc5ca053a26 smbtorture: expand Directory Leases test "v2_request
       via  4aa0f90ac21 smbtorture: simplify test_lease_v2_request()
       via  9695cda30fc smbtorture: add test smb2.dirleases.leases
       via  f10bbff9280 s4/torture: give smb2_generic_create_share() caller 
some flexibility
       via  21d0a2a9ffe selftest: add "smb2.dirlease" test suite
       via  0069019440c smbd: grant Directory Lease if requested
       via  ae3e9dde4c5 smbd: add option "smb3 directory leases"
       via  7b591459229 docs: fix indentation of "strict rename"
       via  0da7b1b820a smbd: allow directory leases in close_directory()
       via  057071360f0 smbd: use get_deferred_open_message_state() in 
open_directory()
       via  f30cdb0c52a libcli/smb: ignore lease_flags and lease_duration for 
leasev1 in smb2_lease_pull()
       via  2b1ef2d894a libcli/smb: rely on the caller zero-initializing 
"lease" in smb2_lease_pull()
       via  0192401c8a0 smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when 
creating hardlink
       via  8762b957143 smbd: trigger change notification when creating hardlink
       via  4f6cb4ab862 vfs_tsmsm: trigger NOTIFY_ACTION_DIRLEASE_BREAK when 
changing offline attribute
       via  306543a071a vfs_gpfs: trigger NOTIFY_ACTION_DIRLEASE_BREAK when 
changing offline attribute
       via  5e37ed09946 smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when 
changing timestamps
       via  8bf40cda539 smbd: in smb_set_file_time() rename "action" variable 
to "filter"
       via  db59ecab86b smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when 
modifying DOS attributes
       via  1300e8dcbe4 smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when setting 
file EOF
       via  4e2c7eb8ffe smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK for renames
       via  5c944aacccb smbd: pass lck down to rename_internals_fsp()
       via  6c923bcd1e7 smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when closing 
a modified file
       via  9ed026dd7ca smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when 
truncating files
       via  680da2b3af3 smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when 
removing directories
       via  1a3606985ca smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when 
removing files
       via  113c5400dc4 s3/locking: return parent_lease_key from 
get_delete_on_close_token()
       via  0beef8d2e8e s3/locking: remember parent_lease_key that set 
delete-on-close
       via  c8f234bbdcf smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when 
creating files and directories
       via  41d0d592b67 smbd: use contend_dirleases() in notify_fname()
       via  ac05f09f22e smbd: add flag NOTIFY_ACTION_DIRLEASE_BREAK for 
notify_fname()
       via  1b53fd14995 smbd: add contend_dirleases()
       via  c1ac9e6532b smbd: pass lease, if any, to notify_fname()
       via  8368236aff1 smbd: pass lease and oplock_request to open_directory()
       via  4256b790d3e smbd: pass fsp to notify_rename()
       via  27f1b7a64df smbd: notify file truncation after dropping the 
sharemode lock
       via  8a046ebf262 smbd: move notify_fname() out of rmdir_internals() up 
to close_directory()
       via  a39d75de305 smbd: call notify_rename() after dropping the lck in 
rename_internals_fsp()
       via  d2f50cad70b smbd: trigger notification for file and directory 
creation will be sent a wee bit later after dropping the sharemode lock
       via  d5dd40ef535 smbd: add fsp_get_smb2_lease()
       via  514a73594b0 smbd: ndrprint lease value in leases_db_set_fn()
       via  e21effb2dd2 smbd: check for handle lease break on destination when 
renaming
       via  49ea685e2ae smbd: Split out smb2_parse_file_rename_information()
       via  a611e6d4027 smbtorture: expand test 
test_lease_v2_rename_target_overwrite()
       via  2b745ad9f69 smbd: recursive delay_for_handle_lease_break_send()
       via  ac3a74b4593 smbd: consolidate "have_file_open_below" logic in 
have_file_open_below()
       via  6703538126f s3/locking: pass file_id instead of lck to 
share_mode_watch_send()
       via  aee574aef90 smbd: print lease key using hex format in 
get_lease_type()
       via  c78ffae3b3a smbd: add has_nonposix_opens()
       via  d6b684120f3 smbd: ignore POSIX opens in file_find_subpath()
       via  7218bffc535 smbd: ignore POSIX and stale opens in 
have_file_open_below()
       via  db3933da6ca smbd: add opens_below_forall() and 
opens_below_forall_read()
       via  79d7d26fd19 s3/locking: add share_entry_forall_read() and 
share_entry_forall() varients
       via  8d744549420 s3/locking: tweak share_entry_forall()
       via  bd120224dba s3/locking: add share_mode_forall() and 
share_mode_forall_read() varients
       via  9b4ff5ff28e s3/g_lock: add g_lock_locks() and g_lock_locks_read() 
varients
       via  5305e361942 smbtorture: add a test for recursive h-lease break when 
renaming
       via  28f9c520fa4 smbd: add handle lease breaking when deleting files in 
tree disconnect
       via  f86208d272c smbd: let smbd_server_connection_terminate_ex() always 
go through smbXsrv_connection_shutdown_send()
       via  ee5d3c63f60 smbd: smbd_server_connection_terminate() may return
       via  644fab6c2aa smbd: add handle lease breaking when deleting files at 
session shutdown time
       via  bb940c5bb66 smbtorture: check initial-delete-on-close breaks 
H-lease for tdis, logoff and disconnect
       via  9e13780a8fc smbd: use delay_for_handle_lease_break_send() for 
initial delete on close
       via  6cc25159d5a smbd: break handle leases when setting 
SMB_FILE_DISPOSITION_INFORMATION
       via  67f56013374 smbd: split out smb_check_file_disposition_info()
       via  aaa9e60ddbc smbtorture: expand test test_lease_unlink() with 
set-delete-on-close
       via  f9c9593225d smbd: rework async rename check for handle lease breaks
       via  00754add3cd smbd: use a DATA_BLOB and avoid data copy in 
delay_rename_for_lease_break()
       via  a771506120f smbd: smbd_do_setfilepathinfo(): pass data as pointer, 
not pointer-to-pointer
       via  ddd8ca35b28 smbd: smbd_do_setfilepathinfo(): one arg per line
       via  3ce664243d6 selftest: run smb2.lease test only against the 
fileserver environment
      from  e3d35ca6944 vfs_ceph_new: Remove unused symbol for ceph_readdir

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


- Log -----------------------------------------------------------------
commit 6f09b61f0b9ccd79c9e8605cad3c16ebf3682f95
Author: Ralph Boehme <[email protected]>
Date:   Thu Oct 24 21:32:49 2024 +0200

    WHATSNEW: SMB3 Directory Leases
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>
    
    Autobuild-User(master): Ralph Böhme <[email protected]>
    Autobuild-Date(master): Tue Nov  5 15:51:27 UTC 2024 on atb-devel-224

commit 14f3f88a3cf98bdc60baaa2d7bdbcfa1fb213749
Author: Ralph Boehme <[email protected]>
Date:   Wed Oct 23 20:11:59 2024 +0200

    smbtorture: Directory Leases vs unlink
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit d805f6e22f4fe895e491d852d2d334c0f7394a0d
Author: Ralph Boehme <[email protected]>
Date:   Mon Oct 21 12:33:08 2024 +0200

    smbtorture: Directory Leases vs hardlink
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 4ed15961d77c37e722a6e4539f64d7b1bf740160
Author: Ralph Boehme <[email protected]>
Date:   Fri Oct 18 18:29:09 2024 +0200

    smbtorture: Directory Leases vs overwrite
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit b59a8331079fe28e667da937c968f7708c23ac87
Author: Ralph Boehme <[email protected]>
Date:   Mon Sep 9 16:03:59 2024 +0200

    smbtorture: Directory Leases vs renaming
    
    Note that we must use defines for the DLEASE* values, as declaring them as 
const
    int triggers a CI failure on one of the runners (opensuse155-samba-o3) 
likely
    due to a bug in its gcc version:
    
      ../../source4/torture/smb2/lease.c:6242:22: error: initializer element is 
not constant
         .srcdir_leasekey = DLEASE1,
                            ^~~~~~~
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit f95867e8f54800b62caec5a55c3e4b81c99ecfeb
Author: Ralph Boehme <[email protected]>
Date:   Mon Sep 9 11:19:32 2024 +0200

    smbtorture: Directory Leases vs setting access date
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 28e8aae6ad5fedaa45f5b7ecef73489536f12024
Author: Ralph Boehme <[email protected]>
Date:   Mon Sep 9 10:37:19 2024 +0200

    smbtorture: Directory Leases vs setting inode change date
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit b277c32dc1d77100b4719c6177baf3eb46188f54
Author: Ralph Boehme <[email protected]>
Date:   Mon Sep 9 10:35:09 2024 +0200

    smbtorture: Directory Leases vs setting modification date
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 1150efd21c68cfbe37452be0ab58d76def71d7ca
Author: Ralph Boehme <[email protected]>
Date:   Fri Oct 18 12:56:31 2024 +0200

    smbtorture: Directory Leases vs setting creation date
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit aa50c19e6bc077ef753d9381bd8e1916d27c191c
Author: Ralph Boehme <[email protected]>
Date:   Fri Oct 18 12:55:42 2024 +0200

    smbtorture: Directory Leases vs setting DOS attributes
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 9b6592d696c49e61883f8e1e9cd4d94701071be9
Author: Ralph Boehme <[email protected]>
Date:   Fri Oct 18 13:02:45 2024 +0200

    smbtorture: Directory Leases vs setting EOF
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 2f4cd3ab94ff5f5262f9e84ec7ccba53262d8ff7
Author: Ralph Boehme <[email protected]>
Date:   Thu Oct 24 19:35:00 2024 +0200

    libcli/smb: only copy the parent lease key if 
SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET is set
    
    MS-SMB2 3.3.5.9.11 Handling the SMB2_CREATE_REQUEST_LEASE_V2 Create Context:
    
      If the SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET bit is set in the Flags field 
of
      the request, Lease.ParentLeaseKey MUST be set to the ParentLeaseKey of the
      request.
    
    Found by MS-SMB2-Prototocol-Testsuite test 
"Compare_Zero_LeaseFlag_ParentLeaseKey".
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit dde84e5fd331705a20262664f2c11a3e9ba11941
Author: Ralph Boehme <[email protected]>
Date:   Thu Oct 24 12:00:40 2024 +0200

    smbtorture: check parent leasekey is ignored unless 
SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET is set
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 52d8af2f423d9c8823970a9de1137a6c3ad3eb50
Author: Ralph Boehme <[email protected]>
Date:   Tue Oct 22 15:05:58 2024 +0200

    libcli/smb: only allow SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET in lease_flag
    
    MS-SMB2 3.3.5.9.11 Handling the SMB2_CREATE_REQUEST_LEASE_V2 Create Context:
    
      The server MUST attempt to locate a Lease by performing a lookup in the
      LeaseTable.LeaseList using the LeaseKey ...
    
      If no lease is found, one MUST be allocated with the following values set:
    
      ...
    
      * Lease.Breaking is set to FALSE.
    
      ...
    
    Ensures we ignore SMB2_LEASE_FLAG_BREAK_IN_PROGRESS. Found by
    MS-SMB2-Prototocol-Testsuite "BreakReadLeaseV2TestCaseS0".
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 9708aebcce8a15a20e734ed46a8b1ee646ea461e
Author: Ralph Boehme <[email protected]>
Date:   Thu Oct 24 11:52:19 2024 +0200

    smbtorture: check SMB2_LEASE_FLAG_BREAK_IN_PROGRESS when client requests 
new lease
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit cc5ca053a2652948815f13a77dc8ca9808f69684
Author: Ralph Boehme <[email protected]>
Date:   Fri Oct 18 17:25:56 2024 +0200

    smbtorture: expand Directory Leases test "v2_request
    
    Add three subtests:
    
    - trigger a sharing violation, ack break, create fails with 
STATUS_SHARING_VIOLATION
    - trigger a sharing violation, close conflicting open, create succeeds
    - write with valid parent lease key.
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 4aa0f90ac21e58d1f799dbd4425e8d2a4c7d3b5f
Author: Ralph Boehme <[email protected]>
Date:   Fri Sep 6 18:07:35 2024 +0200

    smbtorture: simplify test_lease_v2_request()
    
    - Add and use test_rearm_dirlease().
    - Rename variable "ls2" to "dirlease".
    - Simplify lease epoch tracking by using dirlease.lease_epoch as a counter.
    - Add comments.
    - Zero out a handle after closing it.
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 9695cda30fc165d9afe33f770c37d862af8a0ca0
Author: Ralph Boehme <[email protected]>
Date:   Fri Oct 18 17:19:34 2024 +0200

    smbtorture: add test smb2.dirleases.leases
    
    Checks server accepts "RWH", "RH" and "R" lease request and grants at most
    (lease_request & "RH"), so no "W", but "R" without "H" if requested.
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit f10bbff92809bd941a6b47b09453c195d5ba8f6f
Author: Ralph Boehme <[email protected]>
Date:   Sun Feb 27 18:48:49 2022 +0100

    s4/torture: give smb2_generic_create_share() caller some flexibility
    
    This way callers can either create or open a directory.
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 21d0a2a9ffe31e3731ffc623fc575444bd93f5a6
Author: Ralph Boehme <[email protected]>
Date:   Fri Oct 18 14:51:09 2024 +0200

    selftest: add "smb2.dirlease" test suite
    
    Move all existing Directory Leases tests to this test suite and require
    SMB2_CAP_DIRECTORY_LEASING.
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 0069019440cb0c0c9d6f091dd9f27f80629e313d
Author: Ralph Boehme <[email protected]>
Date:   Tue Sep 3 22:08:11 2024 +0200

    smbd: grant Directory Lease if requested
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit ae3e9dde4c5f400a70d15f5ef199c5d8100a0c69
Author: Ralph Boehme <[email protected]>
Date:   Wed May 12 11:24:45 2021 +0200

    smbd: add option "smb3 directory leases"
    
    By default enabled on non-clustered Samba, disabled on clustered Samba, the
    reason being the expected additional load caused by forcing strict rename 
to be
    enabled.
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 7b5914592293fb2c2a7e8cce18028dc66879b0fb
Author: Ralph Boehme <[email protected]>
Date:   Fri Oct 18 16:17:08 2024 +0200

    docs: fix indentation of "strict rename"
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 0da7b1b820a31874a381fd5dc4e7e5e5dfc00661
Author: Ralph Boehme <[email protected]>
Date:   Fri Sep 6 12:28:46 2024 +0200

    smbd: allow directory leases in close_directory()
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 057071360f0dd3577ce3f0de9de0b29a157e33ed
Author: Ralph Boehme <[email protected]>
Date:   Fri Sep 6 11:46:12 2024 +0200

    smbd: use get_deferred_open_message_state() in open_directory()
    
    "deferred" will be used in the function by a later commit...
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit f30cdb0c52a99f79afa9af5a71262dc2a9744dc6
Author: Ralph Boehme <[email protected]>
Date:   Mon Oct 21 12:51:20 2024 +0200

    libcli/smb: ignore lease_flags and lease_duration for leasev1 in 
smb2_lease_pull()
    
    MS-SMB2 2.2.13.2.8 SMB2_CREATE_REQUEST_LEASE:
    
      LeaseFlags (4 bytes): This field MUST NOT be used and MUST be reserved.
      The client MUST set this to 0, and the server MUST ignore it on receipt.
    
      LeaseDuration (8 bytes): This field MUST NOT be used and MUST be reserved.
      The client MUST set this to 0, and the server MUST ignore it on receipt.
    
    So let's really, really ignore it.
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 2b1ef2d894a30648295186ad755affb0032d5581
Author: Ralph Boehme <[email protected]>
Date:   Mon Oct 21 12:48:19 2024 +0200

    libcli/smb: rely on the caller zero-initializing "lease" in 
smb2_lease_pull()
    
    Doing the zero initialization per struct member just feels like a way for 
bugs
    to creep in, even when leasev1 is not going to change ever. The only caller 
has
    already zero-initialized state->lease twice via 1) __tevent_req_create() 
and 2)
    a struct initializer of "state".
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 0192401c8a030782985b070a3436f1dcdd6f0a59
Author: Ralph Boehme <[email protected]>
Date:   Sun Oct 20 21:37:41 2024 +0200

    smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when creating hardlink
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 8762b957143159b750b2c58ec425b5294d372eab
Author: Ralph Boehme <[email protected]>
Date:   Sun Oct 20 21:36:59 2024 +0200

    smbd: trigger change notification when creating hardlink
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 4f6cb4ab8625cadec299ce8f12bd73919b1783f2
Author: Ralph Boehme <[email protected]>
Date:   Wed May 19 15:51:36 2021 +0200

    vfs_tsmsm: trigger NOTIFY_ACTION_DIRLEASE_BREAK when changing offline 
attribute
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 306543a071a8c74b06426ca44fb768d5e3b2aabc
Author: Ralph Boehme <[email protected]>
Date:   Wed May 19 15:51:14 2021 +0200

    vfs_gpfs: trigger NOTIFY_ACTION_DIRLEASE_BREAK when changing offline 
attribute
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 5e37ed09946ff52cdb2249350d2f4d5ed5a809b7
Author: Ralph Boehme <[email protected]>
Date:   Sat Sep 7 15:52:04 2024 +0200

    smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when changing timestamps
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 8bf40cda5392e3facf85fcea53eef07ceeb07226
Author: Ralph Boehme <[email protected]>
Date:   Thu Sep 5 19:00:32 2024 +0200

    smbd: in smb_set_file_time() rename "action" variable to "filter"
    
    This matches the notify_fname() argument name and the next commit is going 
to
    add an "action" variable.
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit db59ecab86baa3e2b63779edf57cfb490eafea69
Author: Ralph Boehme <[email protected]>
Date:   Thu Sep 5 19:29:23 2024 +0200

    smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when modifying DOS attributes
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 1300e8dcbe4718e0fba5cae30cd4b00937f4ae39
Author: Ralph Boehme <[email protected]>
Date:   Wed May 19 15:45:37 2021 +0200

    smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when setting file EOF
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 4e2c7eb8ffedd3a1182d1e41fbf0b76f753da993
Author: Ralph Boehme <[email protected]>
Date:   Sat Sep 7 16:02:23 2024 +0200

    smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK for renames
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 5c944aacccb358e838f348a93e8150ba8007756e
Author: Ralph Boehme <[email protected]>
Date:   Mon Sep 30 20:03:43 2024 +0200

    smbd: pass lck down to rename_internals_fsp()
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 6c923bcd1e79c4d1559a466b0defdd7a28c91382
Author: Ralph Boehme <[email protected]>
Date:   Wed May 12 19:53:38 2021 +0200

    smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when closing a modified file
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 9ed026dd7ca7cd1abc9fe2d41ea1e14110629e5c
Author: Ralph Boehme <[email protected]>
Date:   Sat Oct 19 07:47:33 2024 +0200

    smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when truncating files
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 680da2b3af34e5acf624f04484a1baefa75ebb87
Author: Ralph Boehme <[email protected]>
Date:   Sat Sep 7 15:20:14 2024 +0200

    smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when removing directories
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 1a3606985caf17ac2298c4aeae4444d4e8664b51
Author: Ralph Boehme <[email protected]>
Date:   Sat Sep 7 16:21:41 2024 +0200

    smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when removing files
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 113c5400dc4450bb9a4ea6df454d7b3e3d976697
Author: Ralph Boehme <[email protected]>
Date:   Wed Oct 23 15:38:01 2024 +0200

    s3/locking: return parent_lease_key from get_delete_on_close_token()
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 0beef8d2e8e822f98ca4291247548ea87aee76ce
Author: Ralph Boehme <[email protected]>
Date:   Wed Oct 23 14:10:46 2024 +0200

    s3/locking: remember parent_lease_key that set delete-on-close
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit c8f234bbdcf04c4318c8068bb226b05078afc9f6
Author: Ralph Boehme <[email protected]>
Date:   Mon Sep 9 21:55:36 2024 +0200

    smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when creating files and 
directories
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 41d0d592b6777fb471bde1243dab324d685ceaa5
Author: Ralph Boehme <[email protected]>
Date:   Wed May 19 15:03:48 2021 +0200

    smbd: use contend_dirleases() in notify_fname()
    
    Prepares for Directory Lease breaks.
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit ac05f09f22e851cd422aef41f30f8b6ea3c15318
Author: Ralph Boehme <[email protected]>
Date:   Wed May 19 14:42:14 2021 +0200

    smbd: add flag NOTIFY_ACTION_DIRLEASE_BREAK for notify_fname()
    
    Will be used to trigger Directory Lease breaks from notify_fname().
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 1b53fd14995bc91b62a0bef64b50355247fdc21d
Author: Ralph Boehme <[email protected]>
Date:   Wed Sep 4 17:58:45 2024 +0200

    smbd: add contend_dirleases()
    
    Checks for Directory Lease breaks on the parent directory of smb_fname. 
Gets a
    sharemode lock on the locking.tdb record of the directory, hence it mustn't 
be
    called if the caller still has another sharmode lock.
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit c1ac9e6532b8ea5fca07287cd4ee614617b3df4e
Author: Ralph Boehme <[email protected]>
Date:   Mon Nov 4 18:48:14 2024 +0100

    smbd: pass lease, if any, to notify_fname()
    
    notify_fname() for NOTIFY_ACTION_DIRLEASE_BREAK will soon need the lease of 
the
    current open and to implement "MS-FSA 2.1.4.12 Algorithm to Check for an 
Oplock
    Break" with flags=PARENT_OBJECT.
    
    No change in behaviour for now, all callers pass lease=NULL;
    
    Also change path arg to struct smb_filename.
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 8368236aff11ebe834ea202ac0c8a8a048ba4c1a
Author: Ralph Boehme <[email protected]>
Date:   Tue Sep 3 20:24:22 2024 +0200

    smbd: pass lease and oplock_request to open_directory()
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 4256b790d3e2e81937b63ec882a3a0c2a2678604
Author: Ralph Boehme <[email protected]>
Date:   Mon Oct 21 15:52:29 2024 +0200

    smbd: pass fsp to notify_rename()
    
    Not used for now, that comes soon.
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 27f1b7a64dfa5d5b1916c188f755c1c0a80c2501
Author: Ralph Boehme <[email protected]>
Date:   Mon Nov 4 18:44:08 2024 +0100

    smbd: notify file truncation after dropping the sharemode lock
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 8a046ebf26286af3a994ab15b327d8361e7c8b3c
Author: Ralph Boehme <[email protected]>
Date:   Sat Sep 7 16:24:01 2024 +0200

    smbd: move notify_fname() out of rmdir_internals() up to close_directory()
    
    This way we've already dropped the sharemode lock.
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit a39d75de3057787e726a62d5eb0e7c51dc9af2ae
Author: Ralph Boehme <[email protected]>
Date:   Fri Sep 6 12:40:43 2024 +0200

    smbd: call notify_rename() after dropping the lck in rename_internals_fsp()
    
    Same here, cf the explanation in the previous commit.
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit d2f50cad70bb1ebe7a8b68bce27c353285d33eca
Author: Ralph Boehme <[email protected]>
Date:   Mon Sep 9 21:27:45 2024 +0200

    smbd: trigger notification for file and directory creation will be sent a 
wee bit later after dropping the sharemode lock
    
    This will be a common pattern in the upcoming code dealing with Directory 
Lease
    breaks: when checking for Directory Lease breaks on the parent directory, we
    take the sharemode lock on the parent and hence by then must have dropped 
the
    sharemode lock on the object that performs the Directory Lease break check. 
That
    functionality will be later added to notify_fname().
    
    This means the notification will be sent a wee bit later, but that's 
something
    the change notification protocol has to live with anyway.
    
    For Directory Leases the sequence to check for Directory Lease breaks is to 
call
    MS-FSA 2.1.4.12 "Algorithm to Check for an Oplock Break" with
    flags=PARENT_OBJECT at the end of each relevant operation, eg creating a 
file
    asf, when processing of the operation that will call 2.1.4.12 is already
    completed.
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit d5dd40ef535ac035485a31cb6493615daeebcec6
Author: Ralph Boehme <[email protected]>
Date:   Wed May 19 16:58:21 2021 +0200

    smbd: add fsp_get_smb2_lease()
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 514a73594b01b09fdcc93fa1c360e5b3cf5e1361
Author: Ralph Boehme <[email protected]>
Date:   Wed May 12 21:31:27 2021 +0200

    smbd: ndrprint lease value in leases_db_set_fn()
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit e21effb2dd27c8ea4700abd5e8884e312988f61e
Author: Ralph Boehme <[email protected]>
Date:   Fri Oct 18 08:02:21 2024 +0200

    smbd: check for handle lease break on destination when renaming
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 49ea685e2ae134ed0484a396205e1d10935fe5f3
Author: Ralph Boehme <[email protected]>
Date:   Fri Sep 20 05:14:12 2024 +0200

    smbd: Split out smb2_parse_file_rename_information()
    
    No change in behaviour.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit a611e6d4027b261e666e03532089de7af10c9cf5
Author: Ralph Boehme <[email protected]>
Date:   Mon Oct 14 17:20:16 2024 +0200

    smbtorture: expand test test_lease_v2_rename_target_overwrite()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 2b745ad9f691863812e280504f96d2faa8aeac4d
Author: Ralph Boehme <[email protected]>
Date:   Thu Oct 17 19:18:57 2024 +0200

    smbd: recursive delay_for_handle_lease_break_send()
    
    Check for open files recursively when renaming a directory and wait for 
handle
    lease breaks.
    
    As delay_for_handle_lease_break_send() does the same check as
    have_file_open_below(), remove have_file_open_below() from can_rename() so 
it is
    not called twice for SMB2 renames, and add calls to have_file_open_below() 
to the
    SMB1 entry rename entry points.
    
    This is a bit ugly, but I don't see any other good way of doing this.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit ac3a74b459338da1b129549cdacfd8925f5a8359
Author: Ralph Boehme <[email protected]>
Date:   Sun Oct 13 17:44:18 2024 +0200

    smbd: consolidate "have_file_open_below" logic in have_file_open_below()
    
    Let have_file_open_below() be the single function to check if
    "have_file_open_below" and let it check internally whether to just search 
the
    fsp list in the process or traversing locking.tdb based on the setting of
    "strict rename".
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 6703538126f6b8ab732714eb1e24b8db03d4594f
Author: Ralph Boehme <[email protected]>
Date:   Sun Oct 13 11:57:45 2024 +0200

    s3/locking: pass file_id instead of lck to share_mode_watch_send()
    
    In the future not all callers will have a share_mode_lock around.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit aee574aef90857126caedf9db4d287cf579b4ccb
Author: Ralph Boehme <[email protected]>
Date:   Wed Oct 2 07:46:48 2024 +0200

    smbd: print lease key using hex format in get_lease_type()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit c78ffae3b3a93cf31bb826f6a66fb955385e11c5
Author: Ralph Boehme <[email protected]>
Date:   Wed Oct 16 07:37:25 2024 +0200

    smbd: add has_nonposix_opens()
    
    ...reusing has_other_nonposix_opens_fn().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit d6b684120f324ce69707806218a1a3fc7e6febba
Author: Ralph Boehme <[email protected]>
Date:   Sun Oct 6 16:37:47 2024 +0200

    smbd: ignore POSIX opens in file_find_subpath()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 7218bffc535d743dfe42595ceeaa5f36283fb321
Author: Ralph Boehme <[email protected]>
Date:   Mon Sep 30 16:50:49 2024 +0200

    smbd: ignore POSIX and stale opens in have_file_open_below()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit db3933da6ca1ae63a2c322cf78e83699e867c6ba
Author: Ralph Boehme <[email protected]>
Date:   Sat Oct 12 16:33:47 2024 +0200

    smbd: add opens_below_forall() and opens_below_forall_read()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 79d7d26fd193103ae74d754c5fbe851deeb1d9a5
Author: Ralph Boehme <[email protected]>
Date:   Sun Oct 13 11:11:32 2024 +0200

    s3/locking: add share_entry_forall_read() and share_entry_forall() varients
    
    All existing callers use share_entry_forall_read, so no change in behaviour.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 8d744549420b3be4b4e01ac7165e04ab845ada93
Author: Ralph Boehme <[email protected]>
Date:   Sat Oct 12 16:03:56 2024 +0200

    s3/locking: tweak share_entry_forall()
    
    Gives the callback function more control about when of a locking.tdb
    traverse is stopped. If the callback function returns:
    
      0 => continue traverse
      1 => stop loop over share_mode_entries, but continue share_mode_data 
traverse
     -1 => stop whole share_mode_data traverse
    
    All existing callers of share_entry_forall() either return 0 or -1 from 
their
    callback functions, so no change in behaviour.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit bd120224dbaf531c1f028ea4a3fc8a0b200dce6a
Author: Ralph Boehme <[email protected]>
Date:   Sat Oct 12 17:32:01 2024 +0200

    s3/locking: add share_mode_forall() and share_mode_forall_read() varients
    
    All existing callers use share_mode_forall_read(), so no change in 
behaviour.
    
    Note: doing the indirection via the function pointers "ro_fn" and "rw_fn" 
in a
    single state "struct share_mode_forall_state" avoids duplicating
    share_mode_forall_dump_fn() and share_mode_forall_fn() and has the benefit 
of
    code sharing of these functions for both read-only and read-write cases.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 9b4ff5ff28e35d1f7837b44a2b47c3ee2691b3b0
Author: Ralph Boehme <[email protected]>
Date:   Sat Oct 12 16:36:21 2024 +0200

    s3/g_lock: add g_lock_locks() and g_lock_locks_read() varients
    
    Gives callers the option to modify data if needed. All existing
    callers use g_lock_locks_read(), so no change in behaviour.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 5305e361942c0893143abf74fd832c71fb844643
Author: Ralph Boehme <[email protected]>
Date:   Wed Oct 2 07:47:25 2024 +0200

    smbtorture: add a test for recursive h-lease break when renaming
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 28f9c520fa412745fa1d32d8650ed01d3e95107f
Author: Ralph Boehme <[email protected]>
Date:   Sat Sep 28 16:48:31 2024 +0200

    smbd: add handle lease breaking when deleting files in tree disconnect
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit f86208d272cfa0ce6753b02d3f5b1cce4fd91e2e
Author: Ralph Boehme <[email protected]>
Date:   Sat Sep 28 16:44:31 2024 +0200

    smbd: let smbd_server_connection_terminate_ex() always go through 
smbXsrv_connection_shutdown_send()
    
    This ensures common cleanup code via
    
      smbXsrv_connection_shutdown_send() ->
      -> smbXsrv_session_disconnect_xconn()
      -> smbXsrv_session_remove_channel()
      -> smb2srv_session_shutdown_send()
    
    is used if the last (only) connection goes away as well. In the future this
    should be implemented for the
    
      xconn->has_cluster_movable_ip
    
    case.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit ee5d3c63f60ec4d353d799f9427b5325de4cdccd
Author: Ralph Boehme <[email protected]>
Date:   Tue Oct 22 07:56:53 2024 +0200

    smbd: smbd_server_connection_terminate() may return
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 644fab6c2aac4316d8310cb0c8a8d1e10e54230e
Author: Ralph Boehme <[email protected]>
Date:   Tue Sep 17 07:16:51 2024 +0200

    smbd: add handle lease breaking when deleting files at session shutdown time
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit bb940c5bb66c3773726f11f223a3da3d877ab213
Author: Ralph Boehme <[email protected]>
Date:   Sat Sep 14 13:22:20 2024 +0200

    smbtorture: check initial-delete-on-close breaks H-lease for tdis, logoff 
and disconnect
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 9e13780a8fc48ae8eeda9b14fe72e828166edb3d
Author: Ralph Boehme <[email protected]>
Date:   Sat Sep 14 19:19:51 2024 +0200

    smbd: use delay_for_handle_lease_break_send() for initial delete on close
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13458
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 6cc25159d5a0b5be024629467b866939dd667036
Author: Ralph Boehme <[email protected]>
Date:   Mon Oct 14 18:47:48 2024 +0200

    smbd: break handle leases when setting SMB_FILE_DISPOSITION_INFORMATION
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13458
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 67f560133744eaee9793562f0b48a67ea4221243
Author: Ralph Boehme <[email protected]>
Date:   Fri Oct 11 15:30:46 2024 +0200

    smbd: split out smb_check_file_disposition_info()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13458
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit aaa9e60ddbcd7c905699739c9d70cb71bc2f74bc
Author: Ralph Boehme <[email protected]>
Date:   Mon Sep 16 21:29:10 2024 +0200

    smbtorture: expand test test_lease_unlink() with set-delete-on-close
    
    Currently the test only uses initial-delete-on-close. Expand the test to 
also
    use set-delete-on-close.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13458
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit f9c9593225d48706cbed698efc1b2b7f6760966d
Author: Ralph Boehme <[email protected]>
Date:   Mon Sep 16 02:36:00 2024 +0200

    smbd: rework async rename check for handle lease breaks
    
    Add a version of delay_rename_for_lease_break() that is usable in other 
places
    where we have to check for handle lease breaks. No change in behaviour.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 00754add3cdcd325c1beb527f252069dd6a3af82
Author: Ralph Boehme <[email protected]>
Date:   Fri Oct 11 14:25:44 2024 +0200

    smbd: use a DATA_BLOB and avoid data copy in delay_rename_for_lease_break()
    
    in_input_buffer just points into the smbd_smb2_request iovecs data which is
    guarenteed to have the same lifetime as the deferred rename processing, no 
need
    to make a copy.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit a771506120f4ab08d5f2c2c58e1ca78b6e1b4aa1
Author: Ralph Boehme <[email protected]>
Date:   Fri Oct 11 14:15:32 2024 +0200

    smbd: smbd_do_setfilepathinfo(): pass data as pointer, not 
pointer-to-pointer
    
    No change in behaviour.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit ddd8ca35b28578bb92cb7c5b97201c1ec1498f05
Author: Ralph Boehme <[email protected]>
Date:   Fri Oct 11 14:05:08 2024 +0200

    smbd: smbd_do_setfilepathinfo(): one arg per line
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 3ce664243d677017ac5e13679dde4ae8b1c4f6ba
Author: Ralph Boehme <[email protected]>
Date:   Fri Oct 11 13:44:05 2024 +0200

    selftest: run smb2.lease test only against the fileserver environment
    
    ...and expect SMB2_CAP_LEASING.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

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

Summary of changes:
 WHATSNEW.txt                                       |   13 +
 .../smbdotconf/locking/smb3directoryleases.xml     |   40 +
 docs-xml/smbdotconf/tuning/strictrename.xml        |    6 +-
 lib/param/loadparm.c                               |    2 +
 libcli/smb/smb2_lease.c                            |   16 +-
 selftest/knownfail                                 |    1 -
 selftest/knownfail.d/lease_rename_with_overwrite   |    1 -
 source3/include/g_lock.h                           |    3 +
 source3/include/smb.h                              |    1 +
 source3/lib/g_lock.c                               |   25 +-
 source3/librpc/idl/open_files.idl                  |    1 +
 source3/locking/leases_db.c                        |    5 +
 source3/locking/locking.c                          |   26 +-
 source3/locking/proto.h                            |    3 +-
 source3/locking/share_mode_lock.c                  |  153 +-
 source3/locking/share_mode_lock.h                  |   24 +-
 source3/modules/vfs_gpfs.c                         |   28 +-
 source3/modules/vfs_tsmsm.c                        |   30 +-
 source3/param/loadparm.c                           |   25 +-
 source3/param/loadparm.h                           |    2 +
 source3/rpc_server/srvsvc/srv_srvsvc_nt.c          |    8 +-
 source3/selftest/tests.py                          |    4 +
 source3/smbd/blocking.c                            |    2 +-
 source3/smbd/close.c                               |  109 +-
 source3/smbd/dir.c                                 |  224 +-
 source3/smbd/dir.h                                 |   15 +-
 source3/smbd/dosmode.c                             |   14 +-
 source3/smbd/files.c                               |    6 +-
 source3/smbd/globals.h                             |    4 +-
 source3/smbd/notify.c                              |   16 +-
 source3/smbd/open.c                                |  109 +-
 source3/smbd/proto.h                               |   41 +-
 source3/smbd/smb1_trans2.c                         |   13 +-
 source3/smbd/smb2_close.c                          |   96 +
 source3/smbd/smb2_lock.c                           |    2 +-
 source3/smbd/smb2_negprot.c                        |   22 +-
 source3/smbd/smb2_oplock.c                         |  665 ++++-
 source3/smbd/smb2_reply.c                          |  102 +-
 source3/smbd/smb2_server.c                         |   64 +-
 source3/smbd/smb2_setinfo.c                        |  649 +++--
 source3/smbd/smb2_tcon.c                           |   29 +
 source3/smbd/smb2_trans2.c                         |  190 +-
 source3/smbd/smbXsrv_session.c                     |  159 +
 source3/smbd/smbXsrv_session.h                     |    9 +
 source3/smbd/vfs.c                                 |   11 +-
 source3/utils/net_g_lock.c                         |    4 +-
 source3/utils/status.c                             |    2 +-
 source4/torture/smb2/lease.c                       | 3051 ++++++++++++++++++--
 source4/torture/smb2/lease_break_handler.h         |   26 +
 source4/torture/smb2/smb2.c                        |    1 +
 source4/torture/smb2/util.c                        |    1 -
 51 files changed, 5292 insertions(+), 761 deletions(-)
 create mode 100644 docs-xml/smbdotconf/locking/smb3directoryleases.xml
 delete mode 100644 selftest/knownfail.d/lease_rename_with_overwrite


Changeset truncated at 500 lines:

diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index c9db9360169..de4bb9d6e4e 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -16,6 +16,18 @@ UPGRADING
 NEW FEATURES/CHANGES
 ====================
 
+SMB3 Directory Leases
+---------------------
+
+Starting with Samba 4.22 SMB3 Directory Leases are supported. The new global
+option "smb3 directory leases" controls whether the feature is enabled or
+not. By default, SMB3 Directory Leases are enabled on non-clustered Samba and
+disabled on clustered Samba, based on the "clustering" option. See man smb.conf
+for more details.
+
+SMB3 Directory Leases allow clients to cache directory listings and, depending
+on the workload, result in a decent reduction in SMB requests from clients.
+
 
 REMOVED FEATURES
 ================
@@ -43,6 +55,7 @@ smb.conf changes
 
   Parameter Name                          Description     Default
   --------------                          -----------     -------
+  smb3 directory leases                   New             Auto
   vfs mkdir use tmp name                  New             Auto
   fruit:posix_rename                      Removed
 
diff --git a/docs-xml/smbdotconf/locking/smb3directoryleases.xml 
b/docs-xml/smbdotconf/locking/smb3directoryleases.xml
new file mode 100644
index 00000000000..2d36d3c5b8f
--- /dev/null
+++ b/docs-xml/smbdotconf/locking/smb3directoryleases.xml
@@ -0,0 +1,40 @@
+<samba:parameter name="smb3 directory leases"
+                 context="G"
+                 type="enum"
+                 enumlist="enum_bool_auto"
+                function="_smb3_directory_leases"
+                 xmlns:samba="http://www.samba.org/samba/DTD/samba-doc";>
+<description>
+  <para>
+    This is an enumerated type that controls <command
+    moreinfo="none">smbd</command> whether SMB3 directory leases are
+    enabled. Directory Leasing is an SMB3-only feature which allows
+    clients to cache directories.
+  </para>
+  <para>
+    Possible values for <smbconfoption name="smb3 directory leases"/>
+    are <constant>yes</constant>, <constant>no</constant> and
+    <constant>auto</constant>, <constant>auto</constant> being the
+    default.
+  </para>
+  <para>
+    When set to <constant>auto</constant>, the effective value depends on the
+    option <smbconfoption name="clustering"/>. If <smbconfoption
+    name="clustering"/> is enabled, <smbconfoption name="smb3 directory
+    leases"/> are disabled and the other way around.
+  </para>
+  <para>
+    <smbconfoption name="smb3 directory leases"/> are only available
+    with <smbconfoption name="smb2 leases">yes</smbconfoption>,
+    <smbconfoption name="oplocks">yes</smbconfoption> and
+    <smbconfoption name="kernel oplocks">no</smbconfoption>.
+  </para>
+  <para>
+    Enabling <smbconfoption name="smb3 directory leases"/> implicitly enables
+    <smbconfoption name="strict rename"/>.
+  </para>
+</description>
+
+<related>smb2 leases</related>
+<value type="default">auto</value>
+</samba:parameter>
diff --git a/docs-xml/smbdotconf/tuning/strictrename.xml 
b/docs-xml/smbdotconf/tuning/strictrename.xml
index 91572f2994e..446f83378bb 100644
--- a/docs-xml/smbdotconf/tuning/strictrename.xml
+++ b/docs-xml/smbdotconf/tuning/strictrename.xml
@@ -1,6 +1,7 @@
 <samba:parameter name="strict rename"
                  context="S"
-                                type="boolean"
+                 type="boolean"
+                function="_strict_rename"
                  xmlns:samba="http://www.samba.org/samba/DTD/samba-doc";>
 <description>
     <para>By default a Windows SMB server prevents directory
@@ -28,6 +29,9 @@
     pathnames) then renames are always allowed and this parameter
     has no effect.</para>
 
+    <para>Enabling <smbconfoption name="smb3 directory leases"/> implicitly
+    enables <smbconfoption name="strict rename"/>.</para>
+
 </description>
 
 <value type="default">no</value>
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index db434e66262..c867527f255 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -3077,6 +3077,8 @@ struct loadparm_context *loadparm_init(TALLOC_CTX 
*mem_ctx)
 
        lpcfg_do_global_parameter(lp_ctx, "smb2 leases", "yes");
 
+       lpcfg_do_global_parameter(lp_ctx, "smb3 directory leases", "Auto");
+
        lpcfg_do_global_parameter(lp_ctx, "server multi channel support", 
"yes");
 
        lpcfg_do_global_parameter(lp_ctx, "kerberos encryption types", "all");
diff --git a/libcli/smb/smb2_lease.c b/libcli/smb/smb2_lease.c
index fc641ff7c99..d28477b1911 100644
--- a/libcli/smb/smb2_lease.c
+++ b/libcli/smb/smb2_lease.c
@@ -23,6 +23,11 @@
 #include "includes.h"
 #include "../libcli/smb/smb_common.h"
 
+/**
+ * Pull a lease off the wire into a struct smb2_lease.
+ *
+ * Note: the caller MUST zero initialize "lease".
+ **/
 ssize_t smb2_lease_pull(const uint8_t *buf, size_t len,
                        struct smb2_lease *lease)
 {
@@ -41,17 +46,18 @@ ssize_t smb2_lease_pull(const uint8_t *buf, size_t len,
 
        memcpy(&lease->lease_key, buf, 16);
        lease->lease_state = IVAL(buf, 16);
-       lease->lease_flags = IVAL(buf, 20);
-       lease->lease_duration = BVAL(buf, 24);
        lease->lease_version = version;
 
        switch (version) {
        case 1:
-               ZERO_STRUCT(lease->parent_lease_key);
-               lease->lease_epoch = 0;
                break;
        case 2:
-               memcpy(&lease->parent_lease_key, buf+32, 16);
+               lease->lease_flags = IVAL(buf, 20);
+               lease->lease_flags &= SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET;
+               if (lease->lease_flags & SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET) {
+                       memcpy(&lease->parent_lease_key, buf+32, 16);
+               }
+               lease->lease_duration = BVAL(buf, 24);
                lease->lease_epoch = SVAL(buf, 48);
                break;
        }
diff --git a/selftest/knownfail b/selftest/knownfail
index 5f64e4edad0..dee099b79c1 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -216,7 +216,6 @@
 ^samba3.smb2.setinfo.setinfo
 ^samba3.smb2.session.*reauth5 # some special anonymous checks?
 ^samba3.smb2.lock.*replay_broken_windows # This tests the windows behaviour
-^samba3.smb2.lease.unlink # we currently do not downgrade RH lease to R after 
unlink
 ^samba4.smb2.ioctl.compress_notsup.*\(ad_dc_ntvfs\)
 ^samba3.raw.session.*reauth2 # maybe fix this?
 ^samba3.rpc.lsa.secrets.seal # This gives NT_STATUS_LOCAL_USER_SESSION_KEY
diff --git a/selftest/knownfail.d/lease_rename_with_overwrite 
b/selftest/knownfail.d/lease_rename_with_overwrite
deleted file mode 100644
index 4f97b1659cc..00000000000
--- a/selftest/knownfail.d/lease_rename_with_overwrite
+++ /dev/null
@@ -1 +0,0 @@
-^samba3.smb2.lease.v2_rename_target_overwrite\(nt4_dc\)
diff --git a/source3/include/g_lock.h b/source3/include/g_lock.h
index d6c1521a52c..ceb556c5489 100644
--- a/source3/include/g_lock.h
+++ b/source3/include/g_lock.h
@@ -92,6 +92,9 @@ NTSTATUS g_lock_writev_data(
 NTSTATUS g_lock_write_data(struct g_lock_ctx *ctx, TDB_DATA key,
                           const uint8_t *buf, size_t buflen);
 
+int g_lock_locks_read(struct g_lock_ctx *ctx,
+                     int (*fn)(TDB_DATA key, void *private_data),
+                     void *private_data);
 int g_lock_locks(struct g_lock_ctx *ctx,
                 int (*fn)(TDB_DATA key, void *private_data),
                 void *private_data);
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 7f3482fe442..4cebe366346 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -401,6 +401,7 @@ struct interface {
 #define NOTIFY_ACTION_ADDED_STREAM 6
 #define NOTIFY_ACTION_REMOVED_STREAM 7
 #define NOTIFY_ACTION_MODIFIED_STREAM 8
+#define NOTIFY_ACTION_DIRLEASE_BREAK 256 /* Flag ORed to the above actions */
 
 /* where to find the base of the SMB packet proper */
 #define smb_base(buf) (((const char *)(buf))+4)
diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c
index 28181a9f18a..d0ca32199ea 100644
--- a/source3/lib/g_lock.c
+++ b/source3/lib/g_lock.c
@@ -1558,6 +1558,29 @@ static int g_lock_locks_fn(struct db_record *rec, void 
*priv)
        return state->fn(key, state->private_data);
 }
 
+int g_lock_locks_read(struct g_lock_ctx *ctx,
+                     int (*fn)(TDB_DATA key, void *private_data),
+                     void *private_data)
+{
+       struct g_lock_locks_state state;
+       NTSTATUS status;
+       int count;
+
+       SMB_ASSERT(!ctx->busy);
+
+       state.fn = fn;
+       state.private_data = private_data;
+
+       status = dbwrap_traverse_read(ctx->db,
+                                     g_lock_locks_fn,
+                                     &state,
+                                     &count);
+       if (!NT_STATUS_IS_OK(status)) {
+               return -1;
+       }
+       return count;
+}
+
 int g_lock_locks(struct g_lock_ctx *ctx,
                 int (*fn)(TDB_DATA key, void *private_data),
                 void *private_data)
@@ -1571,7 +1594,7 @@ int g_lock_locks(struct g_lock_ctx *ctx,
        state.fn = fn;
        state.private_data = private_data;
 
-       status = dbwrap_traverse_read(ctx->db, g_lock_locks_fn, &state, &count);
+       status = dbwrap_traverse(ctx->db, g_lock_locks_fn, &state, &count);
        if (!NT_STATUS_IS_OK(status)) {
                return -1;
        }
diff --git a/source3/librpc/idl/open_files.idl 
b/source3/librpc/idl/open_files.idl
index 5dea021ff9a..401b0ec092f 100644
--- a/source3/librpc/idl/open_files.idl
+++ b/source3/librpc/idl/open_files.idl
@@ -45,6 +45,7 @@ interface open_files
 
        typedef [public] struct {
                uint32          name_hash;
+               smb2_lease_key  parent_lease_key;
                security_token *delete_nt_token;
                security_unix_token *delete_token;
        } delete_token;
diff --git a/source3/locking/leases_db.c b/source3/locking/leases_db.c
index eae58f5fc82..9be876a9744 100644
--- a/source3/locking/leases_db.c
+++ b/source3/locking/leases_db.c
@@ -487,6 +487,11 @@ static void leases_db_set_fn(
        value->lease_version = state->lease_version;
        value->epoch = state->epoch;
        *modified = true;
+
+       if (CHECK_DEBUGLVL(10)) {
+               DBG_DEBUG("\n");
+               NDR_PRINT_DEBUG(leases_db_value, value);
+       }
 }
 
 NTSTATUS leases_db_set(const struct GUID *client_guid,
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 41b54b14c6b..dd963e4fbaa 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -37,6 +37,7 @@
 
 #include "includes.h"
 #include "lib/util/time_basic.h"
+#include "smbd/proto.h"
 #include "system/filesys.h"
 #include "lib/util/server_id.h"
 #include "share_mode_lock.h"
@@ -782,11 +783,12 @@ bool share_entry_stale_pid(struct share_mode_entry *e)
 ****************************************************************************/
 
 static bool add_delete_on_close_token(struct share_mode_data *d,
-                       uint32_t name_hash,
+                       struct files_struct *fsp,
                        const struct security_token *nt_tok,
                        const struct security_unix_token *tok)
 {
        struct delete_token *tmp, *dtl;
+       const struct smb2_lease *lease = NULL;
 
        tmp = talloc_realloc(d, d->delete_tokens, struct delete_token,
                             d->num_delete_tokens+1);
@@ -796,7 +798,13 @@ static bool add_delete_on_close_token(struct 
share_mode_data *d,
        d->delete_tokens = tmp;
        dtl = &d->delete_tokens[d->num_delete_tokens];
 
-       dtl->name_hash = name_hash;
+       dtl->name_hash = fsp->name_hash;
+
+       lease = fsp_get_smb2_lease(fsp);
+       if (lease != NULL) {
+               dtl->parent_lease_key = lease->parent_lease_key;
+       }
+
        dtl->delete_nt_token = security_token_duplicate(d->delete_tokens, 
nt_tok);
        if (dtl->delete_nt_token == NULL) {
                return false;
@@ -910,9 +918,17 @@ void set_delete_on_close_lck(files_struct *fsp,
        for (i=0; i<d->num_delete_tokens; i++) {
                struct delete_token *dt = &d->delete_tokens[i];
                if (dt->name_hash == fsp->name_hash) {
+                       const struct smb2_lease *lease = NULL;
+
                        d->modified = true;
 
                        /* Replace this token with the given tok. */
+                       ZERO_STRUCT(dt->parent_lease_key);
+                       lease = fsp_get_smb2_lease(fsp);
+                       if (lease != NULL) {
+                               dt->parent_lease_key = lease->parent_lease_key;
+                       }
+
                        TALLOC_FREE(dt->delete_nt_token);
                        dt->delete_nt_token = security_token_duplicate(dt, 
nt_tok);
                        SMB_ASSERT(dt->delete_nt_token != NULL);
@@ -924,7 +940,7 @@ void set_delete_on_close_lck(files_struct *fsp,
                }
        }
 
-       ret = add_delete_on_close_token(d, fsp->name_hash, nt_tok, tok);
+       ret = add_delete_on_close_token(d, fsp, nt_tok, tok);
        SMB_ASSERT(ret);
 
        ndr_err = ndr_push_struct_blob(
@@ -1031,7 +1047,8 @@ static struct delete_token *find_delete_on_close_token(
 bool get_delete_on_close_token(struct share_mode_lock *lck,
                                        uint32_t name_hash,
                                        const struct security_token **pp_nt_tok,
-                                       const struct security_unix_token 
**pp_tok)
+                                       const struct security_unix_token 
**pp_tok,
+                                       struct smb2_lease_key *parent_lease_key)
 {
        struct share_mode_data *d = NULL;
        struct delete_token *dt;
@@ -1055,6 +1072,7 @@ bool get_delete_on_close_token(struct share_mode_lock 
*lck,
        }
        *pp_nt_tok = dt->delete_nt_token;
        *pp_tok =  dt->delete_token;
+       *parent_lease_key = dt->parent_lease_key;
        return true;
 }
 
diff --git a/source3/locking/proto.h b/source3/locking/proto.h
index 7fc177d7aa6..8e03ad8cf5a 100644
--- a/source3/locking/proto.h
+++ b/source3/locking/proto.h
@@ -148,7 +148,8 @@ NTSTATUS remove_lease_if_stale(struct share_mode_lock *lck,
 bool get_delete_on_close_token(struct share_mode_lock *lck,
                                uint32_t name_hash,
                                const struct security_token **pp_nt_tok,
-                               const struct security_unix_token **pp_tok);
+                               const struct security_unix_token **pp_tok,
+                               struct smb2_lease_key *parent_lease_key);
 void reset_delete_on_close_lck(files_struct *fsp,
                               struct share_mode_lock *lck);
 void set_delete_on_close_lck(files_struct *fsp,
diff --git a/source3/locking/share_mode_lock.c 
b/source3/locking/share_mode_lock.c
index 1db9b887907..8ccb3bdeaec 100644
--- a/source3/locking/share_mode_lock.c
+++ b/source3/locking/share_mode_lock.c
@@ -1425,11 +1425,10 @@ static void share_mode_watch_done(struct tevent_req 
*subreq);
 struct tevent_req *share_mode_watch_send(
        TALLOC_CTX *mem_ctx,
        struct tevent_context *ev,
-       struct share_mode_lock *lck,
+       struct file_id *id,
        struct server_id blocker)
 {
-       struct file_id id = share_mode_lock_file_id(lck);
-       TDB_DATA key = locking_key(&id);
+       TDB_DATA key = locking_key(id);
        struct tevent_req *req = NULL, *subreq = NULL;
        struct share_mode_watch_state *state = NULL;
 
@@ -1743,9 +1742,12 @@ NTSTATUS fetch_share_mode_recv(struct tevent_req *req,
 
 struct share_mode_forall_state {
        TDB_DATA key;
-       int (*fn)(struct file_id fid,
-                 const struct share_mode_data *data,
-                 void *private_data);
+       int (*ro_fn)(struct file_id fid,
+                    const struct share_mode_data *data,
+                    void *private_data);
+       int (*rw_fn)(struct file_id fid,
+                    struct share_mode_data *data,
+                    void *private_data);
        void *private_data;
 };
 
@@ -1785,7 +1787,11 @@ static void share_mode_forall_dump_fn(
                return;
        }
 
-       state->fn(fid, d, state->private_data);
+       if (state->ro_fn != NULL) {
+               state->ro_fn(fid, d, state->private_data);
+       } else {
+               state->rw_fn(fid, d, state->private_data);
+       }
        TALLOC_FREE(d);
 }
 
@@ -1806,13 +1812,36 @@ static int share_mode_forall_fn(TDB_DATA key, void 
*private_data)
        return 0;
 }
 
+int share_mode_forall_read(int (*fn)(struct file_id fid,
+                                    const struct share_mode_data *data,
+                                    void *private_data),
+                          void *private_data)
+{
+       struct share_mode_forall_state state = {
+               .ro_fn = fn,
+               .private_data = private_data
+       };
+       int ret;
+
+       if (lock_ctx == NULL) {
+               return 0;
+       }
+
+       ret = g_lock_locks_read(
+               lock_ctx, share_mode_forall_fn, &state);
+       if (ret < 0) {
+               DBG_ERR("g_lock_locks failed\n");
+       }
+       return ret;
+}
+
 int share_mode_forall(int (*fn)(struct file_id fid,
-                               const struct share_mode_data *data,
+                               struct share_mode_data *data,
                                void *private_data),
                      void *private_data)
 {
        struct share_mode_forall_state state = {
-               .fn = fn,
+               .rw_fn = fn,
                .private_data = private_data
        };
        int ret;
@@ -1831,11 +1860,15 @@ int share_mode_forall(int (*fn)(struct file_id fid,
 
 struct share_entry_forall_state {
        struct file_id fid;
-       const struct share_mode_data *data;
-       int (*fn)(struct file_id fid,
-                 const struct share_mode_data *data,
-                 const struct share_mode_entry *entry,
-                 void *private_data);
+       struct share_mode_data *data;
+       int (*ro_fn)(struct file_id fid,
+                    const struct share_mode_data *data,
+                    const struct share_mode_entry *entry,
+                    void *private_data);
+       int (*rw_fn)(struct file_id fid,
+                    struct share_mode_data *data,
+                    struct share_mode_entry *entry,
+                    void *private_data);
        void *private_data;
        int ret;
 };
@@ -1846,15 +1879,37 @@ static bool share_entry_traverse_walker(
        void *private_data)
 {
        struct share_entry_forall_state *state = private_data;
+       int ret;
 
-       state->ret = state->fn(
-               state->fid, state->data, e, state->private_data);
-       return (state->ret != 0);
+       if (state->ro_fn != NULL) {
+               ret = state->ro_fn(state->fid,
+                                  state->data,
+                                  e,
+                                  state->private_data);
+       } else {
+               ret = state->rw_fn(state->fid,
+                                  state->data,
+                                  e,
+                                  state->private_data);
+       }
+       if (ret == 0) {
+               /* Continue the whole traverse */
+               return 0;
+       } else if (ret == 1) {


-- 
Samba Shared Repository

Reply via email to