From: Volker Lendecke Date: Fri, 23 Aug 2019 15:44:25 +0000 (+0200) Subject: smbd: Remove unused share_mode_stale_pid() X-Git-Tag: talloc-2.3.1~789 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=609143adb68b05dbfa13db0f9289a33b53919a71;p=thirdparty%2Fsamba.git smbd: Remove unused share_mode_stale_pid() Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/locking/locking.c b/source3/locking/locking.c index cf64a962cd8..e7b8fd3a503 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -756,58 +756,6 @@ bool share_entry_stale_pid(struct share_mode_entry *e) return true; } -/* - * In case d->share_modes[i] conflicts with something or otherwise is - * being used, we need to make sure the corresponding process still - * exists. - */ -bool share_mode_stale_pid(struct share_mode_data *d, uint32_t idx) -{ - struct share_mode_entry *e; - bool stale; - - if (idx > d->num_share_modes) { - DBG_WARNING("Asking for index %"PRIu32", " - "only %"PRIu32" around\n", - idx, - d->num_share_modes); - return false; - } - e = &d->share_modes[idx]; - - stale = share_entry_stale_pid(e); - if (!stale) { - return false; - } - d->modified = true; - - if (d->num_delete_tokens != 0) { - uint32_t i; - - for (i=0; inum_share_modes; i++) { - bool valid = !d->share_modes[i].stale; - if (valid) { - break; - } - } - - if (i == d->num_share_modes) { - /* - * No valid (non-stale) share mode found, all - * who might have set the delete token are - * gone. - */ - TALLOC_FREE(d->delete_tokens); - d->num_delete_tokens = 0; - } - } - - remove_share_mode_lease(d, e); - - d->modified = true; - return true; -} - void remove_stale_share_mode_entries(struct share_mode_data *d) { uint32_t i; @@ -822,6 +770,11 @@ void remove_stale_share_mode_entries(struct share_mode_data *d) } i += 1; } + + if (d->num_share_modes == 0) { + TALLOC_FREE(d->delete_tokens); + d->num_delete_tokens = 0; + } } bool set_share_mode(struct share_mode_lock *lck, diff --git a/source3/locking/proto.h b/source3/locking/proto.h index c08517d8ce1..a404fb6530b 100644 --- a/source3/locking/proto.h +++ b/source3/locking/proto.h @@ -170,7 +170,6 @@ 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_entry_stale_pid(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, struct files_struct *fsp, uid_t uid,