From: Ralph Boehme Date: Tue, 17 Sep 2019 16:47:52 +0000 (-0700) Subject: s3/locking: update share_entry_stale_pid() check for Persistent Handles X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c7d49f5e1bb497fc056d0ea56fca3dddfb864bc9;p=thirdparty%2Fsamba.git s3/locking: update share_entry_stale_pid() check for Persistent Handles Disconnected Persistent Handles are NOT "stale" and must be preserved. But while we're at it to check if the handle is connected or not, remember this information so we can check this later in the open code. Signed-off-by: Ralph Boehme Reviewed-by: Anoop C S --- diff --git a/source3/locking/locking.c b/source3/locking/locking.c index 2f78bae6285..dbefbd16f9f 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -726,7 +726,12 @@ bool share_entry_stale_pid(struct share_mode_entry *e) struct server_id_buf buf; bool exists; + if (e->protect) { + SMB_ASSERT(!e->stale); + return false; + } if (e->stale) { + SMB_ASSERT(!e->protect); return true; } @@ -740,6 +745,11 @@ bool share_entry_stale_pid(struct share_mode_entry *e) DBG_DEBUG("PID %s does not exist anymore\n", server_id_str_buf(e->pid, &buf)); + if (e->flags & SHARE_ENTRY_FLAG_PERSISTENT_OPEN) { + e->protect = true; + return false; + } + e->stale = true; return true;