summaryrefslogtreecommitdiff
path: root/source3/locking/locking.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2012-05-22 12:27:06 -0700
committerJeremy Allison <jra@samba.org>2012-05-25 09:19:37 -0700
commit6526432682760f182fdd9152b923fa3468c042ff (patch)
tree6e164748840b56e4b2ac44f9ea4c8624553f9008 /source3/locking/locking.c
parent5842d4e025e4c042829a585fe6c58b71b219386f (diff)
downloadsamba-6526432682760f182fdd9152b923fa3468c042ff.tar.gz
samba-6526432682760f182fdd9152b923fa3468c042ff.tar.bz2
samba-6526432682760f182fdd9152b923fa3468c042ff.zip
Fix an invalid state only reachable on server crash/abort.
Remove any delete-on-close tokens and clear the count if there are no valid share modes. Signed-off-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3/locking/locking.c')
-rw-r--r--source3/locking/locking.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index df21104028..9074d2f0c0 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -653,6 +653,17 @@ bool share_mode_stale_pid(struct share_mode_data *d, unsigned i)
(unsigned)d->num_share_modes));
*e = d->share_modes[d->num_share_modes-1];
d->num_share_modes -= 1;
+
+ if (d->num_share_modes == 0 &&
+ d->num_delete_tokens) {
+ /*
+ * We cannot have any delete tokens
+ * if there are no valid share modes.
+ */
+ TALLOC_FREE(d->delete_tokens);
+ d->num_delete_tokens = 0;
+ }
+
d->modified = true;
return true;
}