logmsg: fix race condition in log_msg_refcache_stop()

This patch fixes a potential race in log_msg_refcache_stop() that happens
as the last references to a LogMessage instance get dropped.

Previously logmsg_current may have been freed by a parallel thread
by the time we call the ack callback as we folded in the ref counter
differences right before calling ack ref and nothing ensured that
log_msg_refcache_stop() still has at least one reference past that.

The solution was to take a ref first and unref that for as long as we need
that reference.

Unfortunately this requires a second atomic operation every time
log_msg_refcache_stop() is called, which was optional until now.

NOTE: having this patch committed, we might as well simplify the
ack + ref counters as no call sites actually change the two at
the same time.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>