1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

smbd: Add share_entry_stale_pid()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2019-08-13 16:00:09 +02:00 committed by Jeremy Allison
parent dc7dfb1257
commit 55e47ada9f
2 changed files with 25 additions and 0 deletions

View File

@ -713,6 +713,30 @@ static void remove_share_mode_lease(struct share_mode_data *d,
remove_lease_if_stale(d, &e->client_guid, &e->lease_key);
}
bool share_entry_stale_pid(struct share_mode_entry *e)
{
struct server_id_buf buf;
bool exists;
if (e->stale) {
return true;
}
exists = serverid_exists(&e->pid);
if (exists) {
DBG_DEBUG("PID %s still exists\n",
server_id_str_buf(e->pid, &buf));
return false;
}
DBG_DEBUG("PID %s does not exist anymore\n",
server_id_str_buf(e->pid, &buf));
e->stale = true;
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

View File

@ -169,6 +169,7 @@ void get_file_infos(struct file_id id,
bool *delete_on_close,
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,