Fix an invalid state only reachable on server crash/abort.
authorJeremy Allison <jra@samba.org>
Tue, 22 May 2012 19:27:06 +0000 (12:27 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 25 May 2012 16:19:37 +0000 (09:19 -0700)
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>
source3/locking/locking.c

index df211040285ae30db396409962eef02472cb3c11..9074d2f0c08dd0dd35606c7afa9cdc1d01f1f417 100644 (file)
@@ -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;
 }