diff options
| author | Stefan Metzmacher <metze@samba.org> | 2014-11-27 18:34:56 +0100 |
|---|---|---|
| committer | Jeremy Allison <jra@samba.org> | 2014-12-04 05:45:09 +0100 |
| commit | 6b2f19a5e6e8b3eb2a44cd24408ba4f27cfb8745 (patch) | |
| tree | 1472e1c6a0959a17f69d13cf162173a33e736265 /source3/locking | |
| parent | 14fac5dbc05823562760ac424522fb39817ec062 (diff) | |
| download | samba-6b2f19a5e6e8b3eb2a44cd24408ba4f27cfb8745.tar.gz samba-6b2f19a5e6e8b3eb2a44cd24408ba4f27cfb8745.tar.xz samba-6b2f19a5e6e8b3eb2a44cd24408ba4f27cfb8745.zip | |
s3:open_files.idl: add data structures for SMB2.1 and SMB3.0 leases.
Pair-Programmed-With: Volker Lendecke <vl@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3/locking')
| -rw-r--r-- | source3/locking/locking.c | 17 | ||||
| -rw-r--r-- | source3/locking/proto.h | 5 | ||||
| -rw-r--r-- | source3/locking/share_mode_lock.c | 12 |
3 files changed, 29 insertions, 5 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c index a320068e6d..9194dd388e 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -608,6 +608,7 @@ bool is_valid_share_mode_entry(const struct share_mode_entry *e) num_props += ((e->op_type == NO_OPLOCK) ? 1 : 0); num_props += (EXCLUSIVE_OPLOCK_TYPE(e->op_type) ? 1 : 0); num_props += (LEVEL_II_OPLOCK_TYPE(e->op_type) ? 1 : 0); + num_props += (e->op_type == LEASE_OPLOCK); if ((num_props > 1) && serverid_exists(&e->pid)) { smb_panic("Invalid share mode entry"); @@ -693,11 +694,21 @@ void remove_stale_share_mode_entries(struct share_mode_data *d) } } -bool set_share_mode(struct share_mode_lock *lck, files_struct *fsp, - uid_t uid, uint64_t mid, uint16 op_type) +bool set_share_mode(struct share_mode_lock *lck, struct files_struct *fsp, + uid_t uid, uint64_t mid, uint16_t op_type, + uint32_t lease_idx) { struct share_mode_data *d = lck->data; struct share_mode_entry *tmp, *e; + struct share_mode_lease *lease = NULL; + + if (lease_idx == UINT32_MAX) { + lease = NULL; + } else if (lease_idx >= d->num_leases) { + return false; + } else { + lease = &d->leases[lease_idx]; + } tmp = talloc_realloc(d, d->share_modes, struct share_mode_entry, d->num_share_modes+1); @@ -716,6 +727,8 @@ bool set_share_mode(struct share_mode_lock *lck, files_struct *fsp, e->access_mask = fsp->access_mask; e->op_mid = mid; e->op_type = op_type; + e->lease_idx = lease_idx; + e->lease = lease; e->time.tv_sec = fsp->open_time.tv_sec; e->time.tv_usec = fsp->open_time.tv_usec; e->id = fsp->file_id; diff --git a/source3/locking/proto.h b/source3/locking/proto.h index 8eccff8370..6b60330fd8 100644 --- a/source3/locking/proto.h +++ b/source3/locking/proto.h @@ -166,8 +166,9 @@ void get_file_infos(struct file_id id, struct timespec *write_time); bool is_valid_share_mode_entry(const struct share_mode_entry *e); bool share_mode_stale_pid(struct share_mode_data *d, uint32_t idx); -bool set_share_mode(struct share_mode_lock *lck, files_struct *fsp, - uid_t uid, uint64_t mid, uint16 op_type); +bool set_share_mode(struct share_mode_lock *lck, struct files_struct *fsp, + uid_t uid, uint64_t mid, uint16_t op_type, + uint32_t lease_idx); void remove_stale_share_mode_entries(struct share_mode_data *d); bool del_share_mode(struct share_mode_lock *lck, files_struct *fsp); bool mark_share_mode_disconnected(struct share_mode_lock *lck, diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c index 6447c61740..2ae7c3373b 100644 --- a/source3/locking/share_mode_lock.c +++ b/source3/locking/share_mode_lock.c @@ -154,7 +154,17 @@ static struct share_mode_data *parse_share_modes(TALLOC_CTX *mem_ctx, */ for (i=0; i<d->num_share_modes; i++) { - d->share_modes[i].stale = false; + struct share_mode_entry *e = &d->share_modes[i]; + + e->stale = false; + e->lease = NULL; + if (e->op_type != LEASE_OPLOCK) { + continue; + } + if (e->lease_idx >= d->num_leases) { + continue; + } + e->lease = &d->leases[e->lease_idx]; } d->modified = false; d->fresh = false; |
