Ticket #48005 - ns-slapd crash in shutdown phase
Description: There was a small window that long running tasks access its
own task object after it's aready released by main thread in the shutdown
period. This patch adds refcounter to such threads and make destructor
wait until the counter becomes 0. Plus, the shutdown check is added to
their task callbacks.
Following tasks are updated by this patch:
slapd/task.c: "fixup tombstones"
posix-winsync/posix-winsync-config.c: "memberuid task"
replication/repl5_replica_config.c: "cleanallruv"
replication/repl5_replica_config.c: "abort cleanallruv"
syntaxes/validate_task.c: "syntax validate"
automember/automember.c: "automember rebuild membership"
automember/automember.c: "automember export updates"
automember/automember.c: "automember map updates"
linkedattrs/linked_attrs.c: "fixup linked attributes"
memberof/memberof.c: "memberof task"
schema_reload/schema_reload.c: "schema reload task"
usn/usn_cleanup.c: "USN tombstone cleanup task"
Following tasks are already covered:
slapd/task.c: "import"
slapd/task.c: "index"
slapd/task.c: "upgradedb"
Following tasks are processed in an ordinary worker thread; no need to change
slapd/task.c: "sysconfig reload"
slapd/task.c: "export"
slapd/task.c: "backup"
slapd/task.c: "restore"
https://fedorahosted.org/389/ticket/48005
Reviewed by mreynolds@redhat.com (Thank you, Mark!!)