]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Add reset_share_mode_entry
authorVolker Lendecke <vl@samba.org>
Fri, 23 Aug 2019 12:13:41 +0000 (14:13 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 17 Sep 2019 22:49:38 +0000 (22:49 +0000)
Mostly for durable reconnect at this point

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/locking/locking.c
source3/locking/proto.h

index eccb680189a21e3bcf110e1bbb622d6824bde537..cf64a962cd889f35410d028181b4e978590eda9a 100644 (file)
@@ -895,6 +895,29 @@ static struct share_mode_entry *find_share_mode_entry(
        return NULL;
 }
 
+bool reset_share_mode_entry(
+       struct share_mode_lock *lck,
+       struct server_id old_pid,
+       uint64_t old_share_file_id,
+       struct server_id new_pid,
+       uint64_t new_mid,
+       uint64_t new_share_file_id)
+{
+       struct share_mode_entry *e = find_share_mode_entry(
+               lck, old_pid, old_share_file_id);
+
+       if (e == NULL) {
+               return false;
+       }
+
+       e->pid = new_pid;
+       e->op_mid = new_mid;
+       e->share_file_id = new_share_file_id;
+
+       lck->data->modified = true;
+       return true;
+}
+
 /*******************************************************************
  Del the share mode of a file for this process.
 ********************************************************************/
index 32f6c64965c1871ef586203475a34a5825496539..c08517d8ce1a79219a93ea9a93de2e6ba2079a75 100644 (file)
@@ -178,6 +178,13 @@ bool set_share_mode(struct share_mode_lock *lck,
                    uint16_t op_type,
                    uint32_t share_access,
                    uint32_t access_mask);
+bool reset_share_mode_entry(
+       struct share_mode_lock *lck,
+       struct server_id old_pid,
+       uint64_t old_share_file_id,
+       struct server_id new_pid,
+       uint64_t new_mid,
+       uint64_t new_share_file_id);
 NTSTATUS remove_lease_if_stale(const struct share_mode_data *d,
                               const struct GUID *client_guid,
                               const struct smb2_lease_key *lease_key);