spacemanager: Avoid a transaction deadlock and reduce DB overhead

When uploading files outside a space reservation to a link group, space manager
creates an implicit reservation for the file. This reservation is created upon
intercepting PoolAcceptFileMessage using information space manager injected
into StorageInfo upon intercepting PoolSelectWritePoolMessage.

Before the link group name was injected into StorageInfo, forcing space manager
to look up link group details when intercepting PoolAcceptFileMessage. Besides
requiring extra database lookups, this also led to a deadlock: The initial read
of the link group creates a shared lock on that row. The subsequent creation of
a temporary reservation causes an update to the link group and thus requires an
excluside lock. When two concurrent transactions do this at the same time, both
may obtain the shared lock and will then block to obtain an exclusive lock.
The RDBMS breaks the deadlock by aborting one of the transactions - and space
manager correctly retries the operation - however this reduces space manager
throughput.

The resolution implemented in this patch is to inject the link group ID rather
than the link group name. The owner information is now calculated from the
subject rather than repeating an authorization check that was already done when
intercepting the pool manager message.

I request back-port to 2.10, as the periodic deadlocks could trigger support
requests (even when they are relatively harmless).

Target: trunk
Request: 2.11
Request: 2.10
Require-notes: yes
Require-book: no
Acked-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
Patch: https://rb.dcache.org/r/7373/
(cherry picked from commit 84b324f1f41672f5188ca3a7186b6883fdd2c233)
Merge pull request #1003 from gbehrmann/fix/2.10/rb7373

spacemanager: Avoid a transaction deadlock and reduce DB overhead