Ensure that block sequences for delete are returned as an ordered set

This commit addresses an issue where the use of delete concurrency for
removal of the blocks of a single object can cause a
riak_cs_delete_fsm worker process to deadlock and prevent the entire
Riak CS garbage collection from making progress. This bug only
manifests for objects that were uploaded using multipart upload.

The problem rests on the fact that the delete_blocks_remaining field
of the object manifest is treated as an ordered set except when that
set is initially determined for a manifest that contains metadata
indicating it was a multipart upload.

The reason this is an issue and that riak_cs_delete_fsm processes can
persist indefinitely is that the ordsets:del_element call is used to
remove elements of the delete_blocks_remaining set as the delete
workers (whose count is controlled by delete_concurrency) respond that
their assigned blocks have been deleted. If a call to
ordsets:del_element is made with an element that does not exist in the
set or more importantly in this case is made on an unordered set where
the element for deletion sorts less than any key ahead of it in the
the set, the return value is identical to the input set. This can come
into play when you have delete_concurrency greater than 1 and a block
delete worker, call it worker A, assigned to delete a block identified
by {UUID, BlockNumber} return a response to the riak_cs_delete_fsm
process before another delete worker, worker B, whose assigned {UUID,
BlockNumber} pair sorts greater than that of worker A, but appears
before the pair of worker A int the set. More concisely, if the block
assigned to worker A sorts less than that assigned to worker B, but
appears after the block assigned to worker B in the
delete_blocks_remaining set in the manifest and worker A responds
before worker B, then the entry for worker A will not be removed from
the delete_blocks_remaining set. Since the delete fsm relies on
delete_blocks_remaining being empty as a termination condition, the
process will hang forever and GC stalls out.

This commit resolves the issue by ensuring that
riak_cs_lfs_utils:block_sequences_for_manifest/1 only returns an
ordered set regardless of the input manifest.

Additionally this commit also adds some type specs to other key
functions in the riak_cs_lfs_utils module and refactors a code block
in riak_cs_delete_fsm:blocks_to_delete_from_manifest to not export
variables from within a case statement.
Add bucket number limit check in Riak CS process

The size of an user record is proportional to bucket number. If too
many buckets were created, then the user's record gets large and
access to anything owned by the user gets slow. This commit adds
bucket number limitation in bucket creation, to prevent user record to
grow too large. As this is not a strict check in a critical section,
there might be a race condition in multiple bucket creations where
they validate total number of owned buckets and then send requests to
Stanchion. But bucket creation is a rare operation, this won't happen
so frequently.

The case where this commit can't prevent growth of an user object is,
when buckets are frequently created and deleted; in that case the user
record may have many deleted bucket records. But that will be pruned.
Add proper error response and tests
Add an eqc to test riak_cs issue 949.
fix wrong log directory for gathering logs on riak-cs-debug.

- fix wrong cs_log_dir when installation using rpm, deb packages.
- avoid to gather lager logs twice.
Optimize list appending when establishing manifest block sequences
Merge pull request #949 from basho/bugfix/delete-fsm-stall

GC may stall due to  riak_cs_delete_fsm deadlock

Reviewed-by: bowrocker
Merge pull request #953 from basho/bugfix/fix-gathering-logs-on-riak-cs-debug

Fix wrong log directory for gathering logs on riak-cs-debug.

Reviewed-by: kuenishi
Merge pull request #948 from basho/refactor/cs-user

Refactor/cs user

Reviewed-by: shino
Please the dialyzer
Avoid DST-aware translation from localtime to GMT

See https://github.com/basho/webmachine/pull/158
Merge pull request #954 from basho/bugfix/avoid-localtime-rounttrip

Avoid DST-aware translation from localtime to GMT

Reviewed-by: kuenishi
ceph_tests create more buckets than 100
Merge pull request #950 from basho/feature/limit-bucket-numbers

Add bucket number limit check in Riak CS process

Reviewed-by: shino
Use new UUID for seed of canonical ID instead of secret
Fix unit test
add partNumber validation.
add invalid part number test.
Merge pull request #956 from basho/feature/another-uuid-for-canonical-id

Use new UUID for seed of canonical ID instead of secret

Reviewed-by: kuenishi
rename the partnumber validator